From 65ed6a2c2f93a9de6b6998fb2023bfd3de1d9467 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Fri, 11 Aug 2017 14:19:01 +0200 Subject: [PATCH] #6613 #6614 simplifying entity definition - using auto-assigned string identifiers to reduce moving parts --- tests/Doctrine/Tests/Models/DDC6613/Phone.php | 30 +++++++++++++ tests/Doctrine/Tests/Models/DDC6613/User.php | 44 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 tests/Doctrine/Tests/Models/DDC6613/Phone.php create mode 100644 tests/Doctrine/Tests/Models/DDC6613/User.php diff --git a/tests/Doctrine/Tests/Models/DDC6613/Phone.php b/tests/Doctrine/Tests/Models/DDC6613/Phone.php new file mode 100644 index 000000000..9ce090960 --- /dev/null +++ b/tests/Doctrine/Tests/Models/DDC6613/Phone.php @@ -0,0 +1,30 @@ + + * 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); + } +} \ No newline at end of file diff --git a/tests/Doctrine/Tests/Models/DDC6613/User.php b/tests/Doctrine/Tests/Models/DDC6613/User.php new file mode 100644 index 000000000..6b233c0a2 --- /dev/null +++ b/tests/Doctrine/Tests/Models/DDC6613/User.php @@ -0,0 +1,44 @@ + + * 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(); + } + + +} \ No newline at end of file