Advertisement
Guest User

Untitled

a guest
Oct 4th, 2013
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.37 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\CoreBundle\Entity;
  4.  
  5. use App\CoreBundle\RedisLayer\Marks\Insert;
  6. use App\CoreBundle\RedisLayer\Marks\Update;
  7. use Doctrine\ORM\Mapping as ORM;
  8.  
  9.  
  10.  
  11. /**
  12.  * Authors
  13.  *
  14.  * @ORM\Table(name="authors")
  15.  * @ORM\Entity
  16.  */
  17. class Author  implements  Insert, Update
  18. {
  19.  
  20.     private $_isCachable = true;
  21.  
  22.  
  23.     /**
  24.      * @var integer
  25.      *
  26.      * @ORM\Column(name="id", type="integer", nullable=false)
  27.      * @ORM\Id
  28.      * @ORM\GeneratedValue(strategy="IDENTITY")
  29.      */
  30.     private $id;
  31.  
  32.     /**
  33.      * @var string
  34.      *
  35.      * @ORM\Column(name="name", type="string", length=255, nullable=false)
  36.      */
  37.     private $name;
  38.  
  39.     /**
  40.      * @var \Doctrine\Common\Collections\Collection
  41.      *
  42.      * @ORM\ManyToMany(targetEntity="App\CoreBundle\Entity\Books", mappedBy="author", cascade={"persist","remove","detach","merge","refresh"})
  43.      */
  44.     private $book;
  45.  
  46.     /**
  47.      * Constructor
  48.      */
  49.     public function __construct()
  50.     {
  51.         $this->book = new \Doctrine\Common\Collections\ArrayCollection();
  52.     }
  53.    
  54.  
  55.     /**
  56.      * Get id
  57.      *
  58.      * @return integer
  59.      */
  60.     public function getId()
  61.     {
  62.         return $this->id;
  63.     }
  64.  
  65.     /**
  66.      * Set name
  67.      *
  68.      * @param string $name
  69.      * @return Authors
  70.      */
  71.     public function setName($name)
  72.     {
  73.         $this->name = $name;
  74.    
  75.         return $this;
  76.     }
  77.  
  78.     /**
  79.      * Get name
  80.      *
  81.      * @return string
  82.      */
  83.     public function getName()
  84.     {
  85.         return $this->name;
  86.     }
  87.  
  88.     /**
  89.      * Add book
  90.      *
  91.      * @param \App\CoreBundle\Entity\Books $book
  92.      * @return Authors
  93.      */
  94.     public function addBook(\App\CoreBundle\Entity\Books $book)
  95.     {
  96.         $book->addAuthor($this);
  97.  
  98.         $this->book[] = $book;
  99.    
  100.         return $this;
  101.     }
  102.  
  103.     /**
  104.      * Remove book
  105.      *
  106.      * @param \App\CoreBundle\Entity\Books $book
  107.      */
  108.     public function removeBook(\App\CoreBundle\Entity\Books $book)
  109.     {
  110.         $this->book->removeElement($book);
  111.     }
  112.  
  113.     /**
  114.      * Get book
  115.      *
  116.      * @return \Doctrine\Common\Collections\Collection
  117.      */
  118.     public function getBook()
  119.     {
  120.         return $this->book;
  121.     }
  122.  
  123.     public function setCachable($isChachable)
  124.     {
  125.         $this->_isCachable = $isChachable;
  126.     }
  127.  
  128.     public function isCachable()
  129.     {
  130.         return $this->_isCachable;
  131.     }
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement