#6613 #6614 simplifying entity definition - using auto-assigned string identifiers to reduce moving parts
This commit is contained in:
parent
d27a9fce7a
commit
65ed6a2c2f
30
tests/Doctrine/Tests/Models/DDC6613/Phone.php
Normal file
30
tests/Doctrine/Tests/Models/DDC6613/Phone.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* User: Uladzimir Struts <Sysaninster@gmail.com>
|
||||
* Date: 11.08.2017
|
||||
* Time: 13:12
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC6613;
|
||||
|
||||
|
||||
/**
|
||||
* @Table(name="ddc6613_phone")
|
||||
*/
|
||||
|
||||
class Phone
|
||||
{
|
||||
|
||||
/**
|
||||
* @Id
|
||||
* @GeneratedValue(strategy="NONE")
|
||||
* @Column(type="integer")
|
||||
*/
|
||||
public $id;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->id = uniqid('phone', true);
|
||||
}
|
||||
}
|
44
tests/Doctrine/Tests/Models/DDC6613/User.php
Normal file
44
tests/Doctrine/Tests/Models/DDC6613/User.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* User: Uladzimir Struts <Sysaninster@gmail.com>
|
||||
* Date: 11.08.2017
|
||||
* Time: 13:12
|
||||
*/
|
||||
|
||||
namespace Doctrine\Tests\Models\DDC6613;
|
||||
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* @Entity()
|
||||
* @Table(name="ddc6613_user")
|
||||
*/
|
||||
class User
|
||||
{
|
||||
|
||||
/**
|
||||
* @Id
|
||||
* @GeneratedValue(strategy="NONE")
|
||||
* @Column(type="string")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
|
||||
/**
|
||||
* @ManyToMany(targetEntity="Phone", fetch="LAZY", cascade={"remove", "detach"})
|
||||
*/
|
||||
public $phones;
|
||||
|
||||
/**
|
||||
* User constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->id = uniqid('user', true);
|
||||
$this->phones = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user