mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 21:57:16 +02:00
Implemented test and logic for AbstractOperation
This commit is contained in:
@@ -3,11 +3,11 @@
|
||||
namespace App\Entity\Source\Operation;
|
||||
|
||||
use App\Logic\Result\ResultInterface;
|
||||
use App\Logic\Operation\OperationInterface;
|
||||
use App\Logic\Operation\OperandInterface;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use App\Entity\Source\AbstractSource;
|
||||
use App\Entity\Source\Operation\Attribut\OperandsAttribut;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@@ -17,8 +17,10 @@ use App\Entity\Source\AbstractSource;
|
||||
* @ORM\DiscriminatorColumn(name="discr", type="string")
|
||||
* @ORM\DiscriminatorMap({"and" = "AndOperation"})
|
||||
*/
|
||||
abstract class AbstractOperation extends AbstractSource implements OperationInterface
|
||||
abstract class AbstractOperation extends AbstractSource implements OperandInterface
|
||||
{
|
||||
use OperandsAttribut;
|
||||
|
||||
/**
|
||||
* The result MUST NOT be saved via Doctrine!
|
||||
*
|
||||
@@ -31,6 +33,12 @@ abstract class AbstractOperation extends AbstractSource implements OperationInte
|
||||
*/
|
||||
protected $operands;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->operands = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getResult(): ResultInterface
|
||||
{
|
||||
return $this->result;
|
||||
|
@@ -11,7 +11,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
* @ORM\Table(name="source_operation_and")
|
||||
* @ORM\Entity()
|
||||
*/
|
||||
class AndOperation extends AbstractOperation
|
||||
final class AndOperation extends AbstractOperation
|
||||
{
|
||||
public function process(): void
|
||||
{
|
||||
|
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source\Operation\Attribut;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
trait OperandsAttribut
|
||||
{
|
||||
/**
|
||||
* @var Collection
|
||||
*/
|
||||
protected $operands;
|
||||
|
||||
/**
|
||||
* @param Collection $collection
|
||||
*/
|
||||
public function setOperands(Collection $operands): void
|
||||
{
|
||||
$this->operands = $operands;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getOperands(): Collection
|
||||
{
|
||||
return $this->operands;
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source\Operation\Attribut;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
interface OperandsAttributInterface
|
||||
{
|
||||
/**
|
||||
* @param Collection $collection
|
||||
*/
|
||||
public function setOperands(Collection $operands): void;
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getOperands(): Collection;
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity\Source\Operation;
|
||||
|
||||
use App\Entity\Source\Operation\Attribut\OperandsAttributInterface;
|
||||
use App\Logic\Operation\OperationInterface as OperationInterfaceOrigine;
|
||||
|
||||
interface OperationInterface extends OperandsAttributInterface, OperationInterfaceOrigine
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user