* deploy script updated
* xsl parser year updated * tree type switched from closure table to nested set
This commit is contained in:
@@ -2,14 +2,14 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Gedmo\Mapping\Annotation as Gedmo;
|
||||
use JsonSerializable;
|
||||
|
||||
/**
|
||||
* @Gedmo\Tree(type="closure")
|
||||
* @Gedmo\TreeClosure(class="App\Entity\FacilityLocationClosure")
|
||||
* @ORM\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\ClosureTreeRepository")
|
||||
* @Gedmo\Tree(type="nested")
|
||||
* @ORM\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\NestedTreeRepository")
|
||||
* @ORM\Table(
|
||||
* name="facility_locations",
|
||||
* indexes={
|
||||
@@ -54,18 +54,38 @@ class FacilityLocation implements JsonSerializable
|
||||
*/
|
||||
private $level;
|
||||
|
||||
/**
|
||||
* @Gedmo\TreeLeft
|
||||
* @ORM\Column(name="lft", type="integer")
|
||||
*/
|
||||
private $lft;
|
||||
|
||||
/**
|
||||
* @Gedmo\TreeRight
|
||||
* @ORM\Column(name="rgt", type="integer")
|
||||
*/
|
||||
private $rgt;
|
||||
|
||||
/**
|
||||
* @Gedmo\TreeRoot
|
||||
* @ORM\ManyToOne(targetEntity="FacilityLocation")
|
||||
* @ORM\JoinColumn(name="tree_root", referencedColumnName="id", onDelete="CASCADE")
|
||||
*/
|
||||
private $root;
|
||||
|
||||
/**
|
||||
* @Gedmo\TreeParent
|
||||
* @ORM\JoinColumn(referencedColumnName="id", onDelete="CASCADE")
|
||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
|
||||
* @ORM\ManyToOne(targetEntity="FacilityLocation", inversedBy="children")
|
||||
* @var FacilityLocation
|
||||
*/
|
||||
private $parent;
|
||||
|
||||
/**
|
||||
* @var FacilityLocationClosure[]
|
||||
* @ORM\OneToMany(targetEntity="FacilityLocation", mappedBy="parent")
|
||||
* @ORM\OrderBy({"lft" = "ASC"})
|
||||
*/
|
||||
private $closures = [];
|
||||
private $children;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="active", type="boolean", options={"default": true})
|
||||
@@ -73,6 +93,11 @@ class FacilityLocation implements JsonSerializable
|
||||
*/
|
||||
private $active = true;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->children = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
@@ -153,16 +178,6 @@ class FacilityLocation implements JsonSerializable
|
||||
return $this->level;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $level
|
||||
* @return FacilityLocation
|
||||
*/
|
||||
public function setLevel($level)
|
||||
{
|
||||
$this->level = $level;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -182,11 +197,11 @@ class FacilityLocation implements JsonSerializable
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FacilityLocationClosure $closure
|
||||
* @return FacilityLocation[]|ArrayCollection
|
||||
*/
|
||||
public function addClosure(FacilityLocationClosure $closure)
|
||||
public function getChildren(): ?ArrayCollection
|
||||
{
|
||||
$this->closures[] = $closure;
|
||||
return $this->children;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Gedmo\Tree\Entity\MappedSuperclass\AbstractClosure;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="facility_locations__closure")
|
||||
*/
|
||||
class FacilityLocationClosure extends AbstractClosure
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user