mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 22:17:26 +01:00
Optimized reciever
This commit is contained in:
parent
48697c8b12
commit
0a18123384
@ -7,6 +7,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
use App\Entity\Attribut\RelationAttribut;
|
||||
use App\Entity\Attribut\RelationAttributInterface;
|
||||
use App\Entity\Attribut\MembersAttribut;
|
||||
use App\Entity\Source\SourceInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@ -27,9 +28,19 @@ class Reciever extends AbstractMeta implements RecieverInterface
|
||||
*/
|
||||
protected $relation;
|
||||
|
||||
public function getAllRecievers(): ArrayCollection
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="App\Entity\AbstractSource")
|
||||
* @ORM\JoinTable(name="meta_reciever_members",
|
||||
* joinColumns={@ORM\JoinColumn(name="reciever_id", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="source_id", referencedColumnName="id")}
|
||||
* )
|
||||
*
|
||||
* @var ArrayCollection | SourceInterface[]
|
||||
*/
|
||||
protected $members;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
foreach ($this->members->getValues() as $source) {
|
||||
}
|
||||
$this->members = new ArrayCollection();
|
||||
}
|
||||
}
|
||||
|
@ -2,14 +2,14 @@
|
||||
|
||||
namespace App\Entity\Meta;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Attribut\RelationAttributInterface;
|
||||
use App\Entity\Attribut\MembersAttributInterface;
|
||||
|
||||
/**
|
||||
* It's neccessary to have an own reciever class, because if you would use a GroupSource it would lead to an infinite loop.
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface RecieverInterface extends RelationAttributInterface, MetaInterface, MembersAttributInterface
|
||||
{
|
||||
public function getAllRecievers(): ArrayCollection;
|
||||
}
|
||||
|
@ -3,9 +3,9 @@
|
||||
namespace App\Tests\Unit\Entity\Meta;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use App\Entity\Meta\Reciever;
|
||||
use App\Entity\Meta\RecieverInterface;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
class RecieverTest extends TestCase
|
||||
{
|
||||
@ -21,6 +21,6 @@ class RecieverTest extends TestCase
|
||||
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$this->assertEquals(Collection::class, $this->reciever->getAllRecievers());
|
||||
$this->assertInstanceOf(Collection::class, $this->reciever->getMembers());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user