2015-02-12 18:53:21 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\Models\Cache;
|
|
|
|
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @Entity
|
|
|
|
* @Table("cache_action")
|
|
|
|
*/
|
|
|
|
class Action
|
|
|
|
{
|
|
|
|
const CLASSNAME = __CLASS__;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @Id
|
|
|
|
* @GeneratedValue
|
|
|
|
* @Column(type="integer")
|
|
|
|
*/
|
2015-02-24 08:49:50 +01:00
|
|
|
public $id;
|
2015-02-12 18:53:21 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @Column
|
|
|
|
*/
|
2015-02-24 08:49:50 +01:00
|
|
|
public $name;
|
2015-02-12 18:53:21 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @OneToMany(targetEntity="Token", cascade={"persist", "remove"}, mappedBy="action")
|
|
|
|
*/
|
2015-02-24 08:49:50 +01:00
|
|
|
public $tokens;
|
2015-02-12 18:53:21 +01:00
|
|
|
|
|
|
|
public function __construct($name)
|
|
|
|
{
|
|
|
|
$this->name = $name;
|
|
|
|
$this->tokens = new ArrayCollection();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addToken(Token $token)
|
|
|
|
{
|
|
|
|
$this->tokens[] = $token;
|
2015-02-24 08:49:50 +01:00
|
|
|
$token->action = $this;
|
2015-02-12 18:53:21 +01:00
|
|
|
}
|
|
|
|
}
|