1
0
mirror of synced 2025-01-10 19:17:10 +03:00
doctrine2/tests/Doctrine/Tests/Models/DDC2775/User.php

41 lines
837 B
PHP
Raw Normal View History

2013-11-04 15:40:51 +04:00
<?php
namespace Doctrine\Tests\Models\DDC2775;
/** @Entity @Table(name="users") */
2013-11-04 15:40:51 +04:00
class User
{
/**
* @Id @Column(type="integer")
* @GeneratedValue(strategy="AUTO")
*/
private $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 getId()
{
return $this->id;
}
public function addRole(Role $role)
{
$this->roles[] = $role;
$role->setUser($this);
}
public function addAuthorization(Authorization $authorization)
{
$this->authorizations[] = $authorization;
$authorization->setUser($this);
}
}