Advertisement
Guest User

Untitled

a guest
Oct 4th, 2013
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.13 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.  * Books
  11.  *
  12.  * @ORM\Table(name="books")
  13.  * @ORM\Entity
  14.  */
  15. class Book implements Insert, Update
  16. {
  17.  
  18.     private $_isCachable = true;
  19.  
  20.  
  21.     /**
  22.      * @var integer
  23.      *
  24.      * @ORM\Column(name="id", type="integer", nullable=false)
  25.      * @ORM\Id
  26.      * @ORM\GeneratedValue(strategy="IDENTITY")
  27.      */
  28.     private $id;
  29.  
  30.     /**
  31.      * @var string
  32.      *
  33.      * @ORM\Column(name="ttile", type="string", length=255, nullable=false)
  34.      */
  35.     private $ttile;
  36.  
  37.     /**
  38.      * @var string
  39.      *
  40.      * @ORM\Column(name="isbn", type="string", length=255, nullable=false)
  41.      */
  42.     private $isbn;
  43.  
  44.     /**
  45.      * @var \Doctrine\Common\Collections\Collection
  46.      *
  47.      * @ORM\ManyToMany(targetEntity="App\CoreBundle\Entity\Authors", inversedBy="book", cascade={"persist","remove","detach","merge","refresh"})
  48.      * @ORM\JoinTable(name="author_books",
  49.      *   joinColumns={
  50.      *     @ORM\JoinColumn(name="book_id", referencedColumnName="id")
  51.      *   },
  52.      *   inverseJoinColumns={
  53.      *     @ORM\JoinColumn(name="author_id", referencedColumnName="id")
  54.      *   }
  55.      * )
  56.      */
  57.     private $author;
  58.  
  59.     /**
  60.      * Constructor
  61.      */
  62.     public function __construct()
  63.     {
  64.         $this->author = new \Doctrine\Common\Collections\ArrayCollection();
  65.     }
  66.    
  67.  
  68.     /**
  69.      * Get id
  70.      *
  71.      * @return integer
  72.      */
  73.     public function getId()
  74.     {
  75.         return $this->id;
  76.     }
  77.  
  78.     /**
  79.      * Set ttile
  80.      *
  81.      * @param string $ttile
  82.      * @return Books
  83.      */
  84.     public function setTtile($ttile)
  85.     {
  86.         $this->ttile = $ttile;
  87.    
  88.         return $this;
  89.     }
  90.  
  91.     /**
  92.      * Get ttile
  93.      *
  94.      * @return string
  95.      */
  96.     public function getTtile()
  97.     {
  98.         return $this->ttile;
  99.     }
  100.  
  101.     /**
  102.      * Set isbn
  103.      *
  104.      * @param string $isbn
  105.      * @return Books
  106.      */
  107.     public function setIsbn($isbn)
  108.     {
  109.         $this->isbn = $isbn;
  110.    
  111.         return $this;
  112.     }
  113.  
  114.     /**
  115.      * Get isbn
  116.      *
  117.      * @return string
  118.      */
  119.     public function getIsbn()
  120.     {
  121.         return $this->isbn;
  122.     }
  123.  
  124.     /**
  125.      * Add author
  126.      *
  127.      * @param \App\CoreBundle\Entity\Authors $author
  128.      * @return Books
  129.      */
  130.     public function addAuthor(\App\CoreBundle\Entity\Authors $author)
  131.     {
  132.         $this->author[] = $author;
  133.    
  134.         return $this;
  135.     }
  136.  
  137.     /**
  138.      * Remove author
  139.      *
  140.      * @param \App\CoreBundle\Entity\Authors $author
  141.      */
  142.     public function removeAuthor(\App\CoreBundle\Entity\Authors $author)
  143.     {
  144.         $this->author->removeElement($author);
  145.     }
  146.  
  147.     /**
  148.      * Get author
  149.      *
  150.      * @return \Doctrine\Common\Collections\Collection
  151.      */
  152.     public function getAuthor()
  153.     {
  154.         return $this->author;
  155.     }
  156.  
  157.     public function setCachable($isChachable)
  158.     {
  159.         $this->_isCachable = $isChachable;
  160.     }
  161.  
  162.     public function isCachable()
  163.     {
  164.         return $this->_isCachable;
  165.     }
  166. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement