src/AtechNet/CoreBundle/Entity/DocumentYear.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\AtechNet\CoreBundle\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping\Column;
  5. use Doctrine\ORM\Mapping\Entity;
  6. use Doctrine\ORM\Mapping\JoinColumn;
  7. use Doctrine\ORM\Mapping\ManyToOne;
  8. use Doctrine\ORM\Mapping\OneToMany;
  9. use Doctrine\ORM\Mapping\OrderBy;
  10. use Doctrine\ORM\Mapping\Table as Table;
  11. /**
  12.  * DocumentYear
  13.  *
  14.  * @Table(name="document_years")
  15.  * @Entity
  16.  */
  17. class DocumentYear extends AbstractSignedEntity
  18. {
  19.     /**
  20.      * @var Company
  21.      *
  22.      * @ManyToOne(targetEntity="Company", inversedBy="documentYears")
  23.      * @JoinColumn(name="company_id", referencedColumnName="id", nullable=false)
  24.      */
  25.     private $company;
  26.     /**
  27.      * @var string
  28.      *
  29.      * @Column(name="year", type="integer", length=4)
  30.      */
  31.     private $year;
  32.     /**
  33.      * @var ArrayCollection
  34.      *
  35.      * @OneToMany(targetEntity="DocumentGroup", mappedBy="year", orphanRemoval=true)
  36.      * @OrderBy({"created" = "DESC"})
  37.      **/
  38.     private $groups;
  39.     /**
  40.      * @return Company
  41.      */
  42.     public function getCompany()
  43.     {
  44.         return $this->company;
  45.     }
  46.     /**
  47.      * @param Company $company
  48.      */
  49.     public function setCompany($company)
  50.     {
  51.         $this->company = $company;
  52.     }
  53.     /**
  54.      * @return string
  55.      */
  56.     public function getYear()
  57.     {
  58.         return $this->year;
  59.     }
  60.     /**
  61.      * @param string $year
  62.      */
  63.     public function setYear($year)
  64.     {
  65.         $this->year = $year;
  66.     }
  67.     /**
  68.      * @return ArrayCollection
  69.      */
  70.     public function getGroups()
  71.     {
  72.         return $this->groups;
  73.     }
  74. }