mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 05:44:58 +00:00
sf4 deprecated: migrate Doctrine ORM mapping to annotation
This commit is contained in:
@@ -20,51 +20,75 @@
|
||||
|
||||
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* ClosingMotive give an explanation why we closed the Accompanying period
|
||||
*
|
||||
* @ORM\Entity(
|
||||
* repositoryClass="Chill\PersonBundle\Repository\ClosingMotiveRepository")
|
||||
* @ORM\Table(name="chill_person_closingmotive")
|
||||
*/
|
||||
class ClosingMotive
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*
|
||||
* @ORM\Column(type="json_array")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var boolean
|
||||
*
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
private $active = true;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var self
|
||||
*
|
||||
* @ORM\ManyToOne(
|
||||
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive",
|
||||
* inversedBy="children")
|
||||
*/
|
||||
private $parent = null;
|
||||
|
||||
/**
|
||||
* child Accompanying periods
|
||||
*
|
||||
* Child Accompanying periods
|
||||
* @var Collection
|
||||
*
|
||||
* @ORM\OneToMany(
|
||||
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive",
|
||||
* mappedBy="parent")
|
||||
*/
|
||||
private $children;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(type="float")
|
||||
*/
|
||||
private $ordering = 0.0;
|
||||
|
||||
|
||||
/**
|
||||
* ClosingMotive constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->children = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,11 +125,18 @@ class ClosingMotive
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isActive(): bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param bool $active
|
||||
* @return $this
|
||||
*/
|
||||
public function setActive(bool $active)
|
||||
{
|
||||
$this->active = $active;
|
||||
@@ -118,17 +149,27 @@ class ClosingMotive
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return ClosingMotive
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getChildren(): Collection
|
||||
{
|
||||
return $this->children;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ClosingMotive|null $parent
|
||||
* @return ClosingMotive
|
||||
*/
|
||||
public function setParent(?ClosingMotive $parent): ClosingMotive
|
||||
{
|
||||
$this->parent = $parent;
|
||||
@@ -139,7 +180,11 @@ class ClosingMotive
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Collection $children
|
||||
* @return ClosingMotive
|
||||
*/
|
||||
public function setChildren(Collection $children): ClosingMotive
|
||||
{
|
||||
$this->children = $children;
|
||||
@@ -147,6 +192,10 @@ class ClosingMotive
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ClosingMotive $child
|
||||
* @return ClosingMotive
|
||||
*/
|
||||
public function addChildren(ClosingMotive $child): ClosingMotive
|
||||
{
|
||||
if ($this->children->contains($child)) {
|
||||
@@ -159,6 +208,10 @@ class ClosingMotive
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ClosingMotive $child
|
||||
* @return ClosingMotive
|
||||
*/
|
||||
public function removeChildren(ClosingMotive $child): ClosingMotive
|
||||
{
|
||||
if ($this->children->removeElement($child)) {
|
||||
@@ -168,33 +221,52 @@ class ClosingMotive
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getOrdering(): float
|
||||
{
|
||||
return $this->ordering;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param float $ordering
|
||||
* @return $this
|
||||
*/
|
||||
public function setOrdering(float $ordering)
|
||||
{
|
||||
$this->ordering = $ordering;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isChild(): bool
|
||||
{
|
||||
return $this->parent !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isParent(): bool
|
||||
{
|
||||
return $this->children->count() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isLeaf(): bool
|
||||
{
|
||||
return $this->children->count() === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasParent(): bool
|
||||
{
|
||||
return $this->parent !== null;
|
||||
|
Reference in New Issue
Block a user