src/Entity/Departments/Departments.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Departments;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. use App\Entity\Services\Service;
  6. use App\Entity\Services\ServiceCategory;
  7. use App\Entity\RequestList;
  8. use App\Entity\User;
  9. /**
  10.  * @Gedmo\Tree(type="nested")
  11.  * @Gedmo\Loggable
  12.  * @ORM\Entity(repositoryClass=App\Repository\Departments\DepartmentsRepository::class)
  13.  */
  14. class Departments
  15. {
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=180, nullable=true)
  24.      */
  25.     private $name;
  26.     /**
  27.      * @ORM\Column(type="text", length=180, nullable=true)
  28.      */
  29.     private $description;
  30.     /**
  31.      * @ORM\Column(type="string", length=180, nullable=true)
  32.      */
  33.     private $type;
  34.     /**
  35.      * @ORM\OneToMany(targetEntity=UserDepartments::class, mappedBy="department", cascade={"persist"}, orphanRemoval=true)
  36.      * @ORM\JoinColumn(nullable=true)
  37.      */
  38.     private $department_users;
  39.     /**
  40.      * @ORM\OneToMany(targetEntity=Service::class, mappedBy="department", cascade={"persist"}, orphanRemoval=true)
  41.      * @ORM\JoinColumn(nullable=true)
  42.      */
  43.     private $services;
  44.     /**
  45.      * @ORM\OneToMany(targetEntity=ServiceCategory::class, mappedBy="department", cascade={"persist"}, orphanRemoval=true)
  46.      * @ORM\JoinColumn(nullable=true)
  47.      */
  48.     private $service_category;
  49.     /**
  50.      * @ORM\ManyToOne(targetEntity=Departments::class)
  51.      * @ORM\JoinColumn(nullable=true)
  52.      */
  53.     private $requested_department;
  54.     /**
  55.      * @Gedmo\Versioned
  56.      * @Gedmo\TreeRoot
  57.      * @ORM\ManyToOne(targetEntity=Departments::class)
  58.      * @ORM\JoinColumn(name="tree_root", referencedColumnName="id", onDelete="CASCADE")
  59.      */
  60.     private $root;
  61.     /**
  62.      * @Gedmo\Versioned
  63.      * @Gedmo\TreeParent
  64.      * @ORM\ManyToOne(targetEntity=Departments::class, inversedBy="children")
  65.      * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
  66.      */
  67.     private $parent_department;
  68.     /**
  69.      * @ORM\OneToMany(targetEntity=Departments::class, mappedBy="parent_department")
  70.      * @ORM\OrderBy({"lft" = "ASC"})
  71.      */
  72.     private $children;
  73.     /**
  74.      * @ORM\OneToMany(targetEntity=RequestList::class, mappedBy="requested_department", cascade={"persist"}))
  75.      * @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
  76.      */
  77.     private $service_request;
  78.     /**
  79.      * @Gedmo\Versioned
  80.      * @Gedmo\TreeLeft
  81.      * @ORM\Column(name="lft", type="integer", nullable=true)
  82.      */
  83.     private $lft;
  84.     /**
  85.      * @Gedmo\Versioned
  86.      * @Gedmo\TreeLevel
  87.      * @ORM\Column(name="lvl", type="integer", nullable=true)
  88.      */
  89.     private $lvl;
  90.     /**
  91.      * @Gedmo\Versioned
  92.      * @Gedmo\TreeRight
  93.      * @ORM\Column(name="rgt", type="integer", nullable=true)
  94.      */
  95.     private $rgt;
  96.     /**
  97.      * @ORM\Column(type="datetime", nullable=true)
  98.      */
  99.     private $created_at;
  100.     /**
  101.      * @ORM\Column(type="datetime", nullable=true)
  102.      */
  103.     private $updated_at;
  104.     /**
  105.      * @ORM\ManyToOne(targetEntity=User::class)
  106.      * @ORM\JoinColumn(nullable=true, referencedColumnName="id", nullable=true)
  107.      */
  108.     private $created_by;
  109.     /**
  110.      * @ORM\ManyToOne(targetEntity=User::class)
  111.      * @ORM\JoinColumn(nullable=true, referencedColumnName="id", nullable=true)
  112.      */
  113.     private $updated_by;
  114.     public function getId(): ?int
  115.     {
  116.         return $this->id;
  117.     }
  118.     /**
  119.      * @return mixed
  120.      */
  121.     public function getName()
  122.     {
  123.         return $this->name;
  124.     }
  125.     /**
  126.      * @param mixed $name
  127.      */
  128.     public function setName($name): void
  129.     {
  130.         $this->name $name;
  131.     }
  132.     /**
  133.      * @return mixed
  134.      */
  135.     public function getDescription()
  136.     {
  137.         return $this->description;
  138.     }
  139.     /**
  140.      * @param mixed $description
  141.      */
  142.     public function setDescription($description): void
  143.     {
  144.         $this->description $description;
  145.     }
  146.     /**
  147.      * @return mixed
  148.      */
  149.     public function getType()
  150.     {
  151.         return $this->type;
  152.     }
  153.     /**
  154.      * @param mixed $type
  155.      */
  156.     public function setType($type): void
  157.     {
  158.         $this->type $type;
  159.     }
  160.     /**
  161.      * @return mixed
  162.      */
  163.     public function getDepartmentUsers()
  164.     {
  165.         return $this->department_users;
  166.     }
  167.     /**
  168.      * @param mixed $department_users
  169.      */
  170.     public function setDepartmentUsers($department_users): void
  171.     {
  172.         $this->department_users $department_users;
  173.     }
  174.     /**
  175.      * @return mixed
  176.      */
  177.     public function getServices()
  178.     {
  179.         return $this->services;
  180.     }
  181.     /**
  182.      * @param mixed $services
  183.      */
  184.     public function setServices($services): void
  185.     {
  186.         $this->services $services;
  187.     }
  188.     /**
  189.      * @return mixed
  190.      */
  191.     public function getParentDepartment()
  192.     {
  193.         return $this->parent_department;
  194.     }
  195.     /**
  196.      * @param mixed $parent_department
  197.      */
  198.     public function setParentDepartment($parent_department): void
  199.     {
  200.         $this->parent_department $parent_department;
  201.     }
  202.     /**
  203.      * @return mixed
  204.      */
  205.     public function getChildren()
  206.     {
  207.         return $this->children;
  208.     }
  209.     /**
  210.      * @param mixed $children
  211.      */
  212.     public function setChildren($children): void
  213.     {
  214.         $this->children $children;
  215.     }
  216.     /**
  217.      * @return mixed
  218.      */
  219.     public function getServiceRequest()
  220.     {
  221.         return $this->service_request;
  222.     }
  223.     /**
  224.      * @param mixed $service_request
  225.      */
  226.     public function setServiceRequest($service_request): void
  227.     {
  228.         $this->service_request $service_request;
  229.     }
  230.     /**
  231.      * @return mixed
  232.      */
  233.     public function getCreatedAt()
  234.     {
  235.         return $this->created_at;
  236.     }
  237.     /**
  238.      * @param mixed $created_at
  239.      */
  240.     public function setCreatedAt($created_at): void
  241.     {
  242.         $this->created_at $created_at;
  243.     }
  244.     /**
  245.      * @return mixed
  246.      */
  247.     public function getUpdatedAt()
  248.     {
  249.         return $this->updated_at;
  250.     }
  251.     /**
  252.      * @param mixed $updated_at
  253.      */
  254.     public function setUpdatedAt($updated_at): void
  255.     {
  256.         $this->updated_at $updated_at;
  257.     }
  258.     /**
  259.      * @return mixed
  260.      */
  261.     public function getCreatedBy()
  262.     {
  263.         return $this->created_by;
  264.     }
  265.     /**
  266.      * @param mixed $created_by
  267.      */
  268.     public function setCreatedBy($created_by): void
  269.     {
  270.         $this->created_by $created_by;
  271.     }
  272.     /**
  273.      * @return mixed
  274.      */
  275.     public function getUpdatedBy()
  276.     {
  277.         return $this->updated_by;
  278.     }
  279.     /**
  280.      * @param mixed $updated_by
  281.      */
  282.     public function setUpdatedBy($updated_by): void
  283.     {
  284.         $this->updated_by $updated_by;
  285.     }
  286.     /**
  287.      * Get the value of service_category
  288.      */ 
  289.     public function getServiceCategory()
  290.     {
  291.         return $this->service_category;
  292.     }
  293.     /**
  294.      * Set the value of service_category
  295.      *
  296.      * @return  self
  297.      */ 
  298.     public function setServiceCategory($service_category)
  299.     {
  300.         $this->service_category $service_category;
  301.         return $this;
  302.     }
  303. /**
  304.  * Get the value of requested_department
  305.  */ 
  306. public function getRequestedDepartment()
  307. {
  308. return $this->requested_department;
  309. }
  310. /**
  311.  * Set the value of requested_department
  312.  *
  313.  * @return  self
  314.  */ 
  315. public function setRequestedDepartment($requested_department)
  316. {
  317. $this->requested_department $requested_department;
  318. return $this;
  319. }
  320. }