<?php
/**
* Product class represents model of Department entity
*
* $Project: Alliancemarkets2 $
* $Id$
*
* @package alliancemarkets2
* @author George Matyas <webexciter@yahoo.com>
* @version $Revision$
*/
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Translatable\Translatable;
/**
*
*
*
* @ORM\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\NestedTreeRepository")
* @ORM\Table(name="department")
* @Gedmo\TranslationEntity(class="App\Entity\DepartmentTranslation")
* @Gedmo\Tree(type="nested")
*
* Doctrine\ORM\Mapping\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\NestedTreeRepository")
*
*/
class Department implements Translatable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $departmentId=0;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $departmentKey;
/**
* @Gedmo\Translatable
* @ORM\Column(type="string", length=100, nullable=true)
*/
protected $departmentName;
/**
* @Gedmo\Translatable
* @ORM\Column(type="text", nullable=true)
*/
protected $departmentDescription;
/**
* Post locale
* Used locale to override Translation listener's locale
*
* @Gedmo\Locale
*
*/
protected $locale;
/**
* Assert\Image( maxSize = "3072k", mimeTypesMessage = "Please upload a valid Image")
*
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $image1;
/**
* @Gedmo\TreeRoot
* @ORM\ManyToOne(targetEntity="Department")
* @ORM\JoinColumn(referencedColumnName="department_id", onDelete="CASCADE")
*/
protected $root;
/**
* @Gedmo\TreeParent
* @ORM\ManyToOne(targetEntity="Department", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="department_id", onDelete="SET NULL")
*/
protected $parent;
/**
* @ORM\OneToMany(targetEntity="Department", mappedBy="parent")
* @ORM\OrderBy({"lft" = "ASC"})
*/
protected $children;
/**
* @Gedmo\TreeLeft
* @Doctrine\ORM\Mapping\Column(type="integer", nullable=true)
*/
protected $lft;
/**
* @Gedmo\TreeLevel
* @ORM\Column(name="lvl", type="integer")
*/
protected $lvl;
/**
* @Gedmo\TreeRight
* @Doctrine\ORM\Mapping\Column(type="integer", nullable=true)
*/
protected $rgt;
/**
* Constructor
*/
public function __construct()
{
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get departmentId
*
* @return integer
*/
public function getDepartmentId()
{
return $this->departmentId;
}
/**
* Set departmentKey
*
* @param string $departmentKey
*
* @return Department
*/
public function setDepartmentKey($departmentKey)
{
$this->departmentKey = $departmentKey;
return $this;
}
/**
* Get departmentKey
*
* @return string
*/
public function getDepartmentKey()
{
return $this->departmentKey;
}
/**
* Set departmentName
*
* @param string $departmentName
*
* @return Department
*/
public function setDepartmentName($departmentName)
{
$this->departmentName = $departmentName;
return $this;
}
/**
* Get departmentName
*
* @return string
*/
public function getDepartmentName()
{
return $this->departmentName;
}
/**
* Set departmentDescription
*
* @param string $departmentDescription
*
* @return Department
*/
public function setDepartmentDescription($departmentDescription)
{
$this->departmentDescription = $departmentDescription;
return $this;
}
/**
* Get departmentDescription
*
* @return string
*/
public function getDepartmentDescription()
{
return $this->departmentDescription;
}
/**
* Set image1
*
* @param string $image1
*
* @return Department
*/
public function setImage1($image1)
{
$this->image1 = $image1;
return $this;
}
/**
* Get image1
*
* @return string
*/
public function getImage1()
{
return $this->image1;
}
/**
* Set lft
*
* @param integer $lft
*
* @return Department
*/
public function setLft($lft)
{
$this->lft = $lft;
return $this;
}
/**
* Get lft
*
* @return integer
*/
public function getLft()
{
return $this->lft;
}
/**
* Set lvl
*
* @param integer $lvl
*
* @return Department
*/
public function setLvl($lvl)
{
$this->lvl = $lvl;
return $this;
}
/**
* Get lvl
*
* @return integer
*/
public function getLvl()
{
return $this->lvl;
}
/**
* Set rgt
*
* @param integer $rgt
*
* @return Department
*/
public function setRgt($rgt)
{
$this->rgt = $rgt;
return $this;
}
/**
* Get rgt
*
* @return integer
*/
public function getRgt()
{
return $this->rgt;
}
/**
* Set root
*
* @param \App\Entity\Department $root
*
* @return Department
*/
public function setRoot(\App\Entity\Department $root = null)
{
$this->root = $root;
return $this;
}
/**
* Get root
*
* @return \App\Entity\Department
*/
public function getRoot()
{
return $this->root;
}
/**
* Set parent
*
* @param \App\Entity\Department $parent
*
* @return Department
*/
public function setParent(\App\Entity\Department $parent = null)
{
$this->parent = $parent;
return $this;
}
/**
* Get parent
*
* @return \App\Entity\Department
*/
public function getParent()
{
return $this->parent;
}
/**
* Add child
*
* @param \App\Entity\Department $child
*
* @return Department
*/
public function addChild(\App\Entity\Department $child)
{
$this->children[] = $child;
return $this;
}
/**
* Remove child
*
* @param \App\Entity\Department $child
*/
public function removeChild(\App\Entity\Department $child)
{
$this->children->removeElement($child);
}
/**
* Get children
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getChildren()
{
return $this->children;
}
/**
* Set locale
*
* @param string $locale
*
* @return Product
*/
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
/**
* Get locale
*
* @return string
*/
public function getLocale()
{
return $this->locale;
}
}