X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fdoctrine%2Form%2Ftests%2FDoctrine%2FTests%2FModels%2FDDC964%2FDDC964User.php;fp=vendor%2Fdoctrine%2Form%2Ftests%2FDoctrine%2FTests%2FModels%2FDDC964%2FDDC964User.php;h=608f42d9663227b017990c2d70784cea6452d88f;hb=8b04b2d11798dee4f3e1358e4f43e97a6df851f6;hp=0000000000000000000000000000000000000000;hpb=73568cf05a785a45f94ca3f2351d9e07bf917958;p=zf2.biz%2Fapplication_blanche.git diff --git a/vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC964/DDC964User.php b/vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC964/DDC964User.php new file mode 100644 index 0000000..608f42d --- /dev/null +++ b/vendor/doctrine/orm/tests/Doctrine/Tests/Models/DDC964/DDC964User.php @@ -0,0 +1,155 @@ +name = $name; + $this->groups = new ArrayCollection; + } + + /** + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * @param DDC964Group $group + */ + public function addGroup(DDC964Group $group) + { + $this->groups->add($group); + $group->addUser($this); + } + + /** + * @return ArrayCollection + */ + public function getGroups() + { + return $this->groups; + } + + /** + * @return DDC964Address + */ + public function getAddress() + { + return $this->address; + } + + /** + * @param DDC964Address $address + */ + public function setAddress(DDC964Address $address) + { + $this->address = $address; + } + + public static function loadMetadata($metadata) + { + $metadata->mapField(array( + 'id' => true, + 'fieldName' => 'id', + 'type' => 'integer', + 'columnName' => 'user_id', + 'length' => 150, + )); + $metadata->mapField(array( + 'fieldName' => 'name', + 'type' => 'string', + 'columnName'=> 'user_name', + 'nullable' => true, + 'unique' => false, + 'length' => 250, + )); + + $metadata->mapManyToOne(array( + 'fieldName' => 'address', + 'targetEntity' => 'DDC964Address', + 'cascade' => array('persist','merge'), + 'joinColumn' => array('name'=>'address_id', 'referencedColumnMame'=>'id'), + )); + + $metadata->mapManyToMany(array( + 'fieldName' => 'groups', + 'targetEntity' => 'DDC964Group', + 'inversedBy' => 'users', + 'cascade' => array('persist','merge','detach'), + 'joinTable' => array( + 'name' => 'ddc964_users_groups', + 'joinColumns' => array(array( + 'name'=>'user_id', + 'referencedColumnName'=>'id', + )), + 'inverseJoinColumns'=>array(array( + 'name'=>'group_id', + 'referencedColumnName'=>'id', + )) + ) + )); + + $metadata->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadataInfo::GENERATOR_TYPE_AUTO); + } +} \ No newline at end of file