mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 21:57:16 +02:00
Implemented TreeCollectionSource
This commit is contained in:
@@ -8,6 +8,8 @@ use App\Helper\DimensionHelper;
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*
|
||||
* @deprecated use instead CollectionDimensionHelper Method
|
||||
*
|
||||
* @todo this attribut should be refactored to mapp fully on collections instead of members
|
||||
*/
|
||||
trait MembersAttribut
|
||||
@@ -31,6 +33,8 @@ trait MembersAttribut
|
||||
* @param int $dimension The dimensions start with 1 for the members of the actuall dimension and NULL for all members
|
||||
* @param Collection $members A reference to a members list, to which new members should be add
|
||||
*
|
||||
* @deprecated Use Instead CollectionDimensionHelperMethod
|
||||
*
|
||||
* @return Collection|MembersAttributInterface[] Returns all members till the defined dimension
|
||||
*/
|
||||
public function getMembersIncludingChildren(?int $dimension = null, Collection $members = null): Collection
|
||||
|
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Method;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use App\Helper\DimensionHelper;
|
||||
use App\Entity\Attribut\MembersAttributInterface;
|
||||
|
||||
/**
|
||||
* @todo Create test for trait!
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
trait CollectionDimensionHelperMethod
|
||||
{
|
||||
public function getDimensions(?int $dimension = null, Collection $elements = null): Collection
|
||||
{
|
||||
$dimensionHelper = new DimensionHelper(__FUNCTION__, MembersAttributInterface::class, $this, 'collection');
|
||||
|
||||
return $dimensionHelper->getDimensions($dimension, $elements);
|
||||
}
|
||||
}
|
@@ -13,8 +13,8 @@ use App\Entity\Attribut\LawAttribut;
|
||||
use App\Entity\Meta\LawInterface;
|
||||
use App\Entity\Meta\Law;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Source\Collection\MemberCollectionSource;
|
||||
use App\Entity\Attribut\MembershipsAttribut;
|
||||
use App\Entity\Source\Collection\TreeCollectionSourceInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -24,7 +24,7 @@ use App\Entity\Attribut\MembershipsAttribut;
|
||||
* @ORM\Table(name="source")
|
||||
* @ORM\InheritanceType("JOINED")
|
||||
* @ORM\DiscriminatorColumn(name="discr", type="string")
|
||||
* @ORM\DiscriminatorMap({"user" = "UserSource","name" = "NameSource","group" = "App\Entity\Source\Collection\MemberCollectionSource"})
|
||||
* @ORM\DiscriminatorMap({"user" = "UserSource","name" = "NameSource","collection" = "App\Entity\Source\Collection\AbstractCollectionSource","operation"="App\Entity\Source\Operation\AbstractOperation"})
|
||||
*/
|
||||
abstract class AbstractSource extends AbstractEntity implements SourceInterface
|
||||
{
|
||||
@@ -42,8 +42,8 @@ abstract class AbstractSource extends AbstractEntity implements SourceInterface
|
||||
* @todo Implement that just one table on database level is needed!
|
||||
* @todo Rename table to use the right schema
|
||||
*
|
||||
* @var Collection|MemberCollectionSource[]
|
||||
* @ORM\ManyToMany(targetEntity="App\Entity\Source\Collection\MemberCollectionSource",mappedBy="collection")
|
||||
* @var Collection|TreeCollectionSourceInterface[]
|
||||
* @ORM\ManyToMany(targetEntity="App\Entity\Source\Collection\TreeCollectionSource",mappedBy="collection")
|
||||
*/
|
||||
protected $memberships;
|
||||
|
||||
|
@@ -14,7 +14,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||
* @ORM\Table(name="source_collection")
|
||||
* @ORM\InheritanceType("JOINED")
|
||||
* @ORM\DiscriminatorColumn(name="discr", type="string")
|
||||
* @ORM\DiscriminatorMap({"member" = "MemberCollectionSource"})
|
||||
* @ORM\DiscriminatorMap({"member" = "TreeCollectionSource"})
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
|
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source\Collection;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use App\Entity\Attribut\MembersAttribut;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
* @ORM\Table(name="source_group")
|
||||
* @ORM\Entity
|
||||
*/
|
||||
final class MemberCollectionSource extends AbstractCollectionSource implements MemberCollectionSourceInterface
|
||||
{
|
||||
use MembersAttribut;
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source\Collection;
|
||||
|
||||
use App\Entity\Attribut\MembersAttributInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface MemberCollectionSourceInterface extends MembersAttributInterface, CollectionSourceInterface
|
||||
{
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source\Collection;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use App\Entity\Attribut\MembersAttribut;
|
||||
use App\Entity\Method\CollectionDimensionHelperMethod;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*
|
||||
* @todo remove deprecated trait membersattribut
|
||||
* @ORM\Table(name="source_group")
|
||||
* @ORM\Entity
|
||||
*/
|
||||
final class TreeCollectionSource extends AbstractCollectionSource implements TreeCollectionSourceInterface
|
||||
{
|
||||
use MembersAttribut;
|
||||
use CollectionDimensionHelperMethod;
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source\Collection;
|
||||
|
||||
use App\Entity\Attribut\MembersAttributInterface;
|
||||
use App\Helper\DimensionHelperInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface TreeCollectionSourceInterface extends MembersAttributInterface, CollectionSourceInterface, DimensionHelperInterface
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user