src/Entity/Category.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use App\Entity\Traits\IdTrait;
  7. use App\Entity\Traits\NameTrait;
  8. use App\Entity\Traits\BatchMethodTrait;
  9. use App\Entity\Traits\OrderTrait;
  10. /**
  11.  *
  12.  * @ORM\Entity(repositoryClass="App\Repository\CategoryRepository")
  13.  */
  14. class Category
  15. {
  16.     use IdTraitNameTraitBatchMethodTraitOrderTrait;
  17.     const NAME '项目类型';
  18.     /**
  19.      *
  20.      * @ORM\ManyToOne(targetEntity="Batch")
  21.      */
  22.     protected $batch;
  23.     /**
  24.      *
  25.      * @ORM\OneToMany(targetEntity="Level", mappedBy="category")
  26.      */
  27.     protected $levels;
  28.     public function __construct()
  29.     {
  30.         $this->levels = new ArrayCollection();
  31.     }
  32.     /**
  33.      *
  34.      * @return Collection|Level[]
  35.      */
  36.     public function getLevels(): Collection
  37.     {
  38.         return $this->levels;
  39.     }
  40. }