1
0
mirror of synced 2025-01-10 19:17:10 +03:00
doctrine2/tests/Doctrine/Tests/Models/DDC2775/Role.php
2013-11-04 12:40:51 +01:00

50 lines
946 B
PHP

<?php
namespace Doctrine\Tests\Models\DDC2775;
/**
* @Entity
* @InheritanceType("JOINED")
* @DiscriminatorColumn(name="role_type", type="string")
* @DiscriminatorMap({"admin"="AdminRole"})
*/
abstract class Role
{
/**
* @Id @Column(type="integer")
* @GeneratedValue
*/
private $id;
/**
* @ManyToOne(targetEntity="User", inversedBy="roles")
*/
private $user;
/**
* @OneToMany(targetEntity="Authorization", mappedBy="role", cascade={"all"}, orphanRemoval=true)
*/
public $authorizations;
public function getId()
{
return $this->id;
}
public function getUser()
{
return $this->user;
}
public function setUser(User $user)
{
$this->user = $user;
}
public function addAuthorization(Authorization $authorization)
{
$this->authorizations[] = $authorization;
$authorization->setRole($this);
}
}