1
0
mirror of synced 2025-01-10 11:07:10 +03:00
doctrine2/tests/Doctrine/Tests/Models/DDC2775/User.php
2013-12-14 19:57:53 +01:00

38 lines
769 B
PHP

<?php
namespace Doctrine\Tests\Models\DDC2775;
/**
* @Entity @Table(name="users")
*/
class User
{
/**
* @Id @Column(type="integer")
* @GeneratedValue(strategy="AUTO")
*/
public $id;
/**
* @OneToMany(targetEntity="Role", mappedBy="user", cascade={"all"}, orphanRemoval=true)
*/
public $roles;
/**
* @OneToMany(targetEntity="Authorization", mappedBy="user", cascade={"all"}, orphanRemoval=true)
*/
public $authorizations;
public function addRole(Role $role)
{
$this->roles[] = $role;
$role->user = $this;
}
public function addAuthorization(Authorization $authorization)
{
$this->authorizations[] = $authorization;
$authorization->user = $this;
}
}