1
0
mirror of synced 2025-02-02 21:41:45 +03:00

#6613 #6614 simplifying entity definition - using auto-assigned string identifiers to reduce moving parts

This commit is contained in:
Marco Pivetta 2017-08-11 14:19:01 +02:00
parent d27a9fce7a
commit 65ed6a2c2f
No known key found for this signature in database
GPG Key ID: 4167D3337FD9D629
2 changed files with 74 additions and 0 deletions

View 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);
}
}

View 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();
}
}