mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-04-16 02:06:23 +02:00
Declared function hasIdentity public
This commit is contained in:
parent
4ac7b3a19b
commit
c3b8e1a92d
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\RequestManagement\Entity;
|
||||
|
||||
use App\Entity\AbstractEntity;
|
||||
@ -17,10 +18,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use App\Attribut\ClassAttribut;
|
||||
use App\Exception\AllreadyDefinedException;
|
||||
use App\Domain\RequestManagement\Right\RequestedRightInterface;
|
||||
use App\Exception\NotDefinedException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
|
||||
@ -30,22 +29,11 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
|
||||
ClassAttribut{ setClass as private setClassTrait; getClass as private getClassTrait; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @var LayerRepositoryFactoryServiceInterface
|
||||
*/
|
||||
private $layerRepositoryFactoryService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return bool True if an identity attribut is defined
|
||||
*/
|
||||
private function hasIdentity(): bool
|
||||
{
|
||||
return $this->hasId() || $this->hasSlug();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws NotSetException
|
||||
*/
|
||||
private function validateHasIdentity(): void
|
||||
@ -56,7 +44,6 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param EntityInterface|null $entity
|
||||
*
|
||||
* @throws NotFoundHttpException
|
||||
@ -69,7 +56,6 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return EntityInterface|SourceInterface|null
|
||||
*/
|
||||
private function loadEntityBySlugOrId(): ?EntityInterface
|
||||
@ -77,11 +63,11 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
|
||||
if ($this->hasSlug()) {
|
||||
return $this->loadBySlug();
|
||||
}
|
||||
|
||||
return $this->loadById();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws NotCorrectInstanceException
|
||||
*
|
||||
* @return SourceInterface|null
|
||||
@ -96,7 +82,6 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return EntityInterface|null
|
||||
*/
|
||||
private function loadById(): ?EntityInterface
|
||||
@ -107,7 +92,6 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return RepositoryInterface
|
||||
*/
|
||||
private function getEntityRepository(): RepositoryInterface
|
||||
@ -119,7 +103,6 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param EntityManagerInterface $entityManager
|
||||
*/
|
||||
public function __construct(LayerRepositoryFactoryServiceInterface $layerRepositoryFactoryService)
|
||||
@ -128,7 +111,16 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Domain\RequestManagement\Entity\RequestedEntityInterface::hasIdentity()
|
||||
*/
|
||||
public function hasIdentity(): bool
|
||||
{
|
||||
return $this->hasId() || $this->hasSlug();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Domain\RequestManagement\Entity\RequestedEntityInterface::setIdentity()
|
||||
@ -149,7 +141,6 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Attribut\ClassAttributInterface::setClass()
|
||||
@ -163,7 +154,6 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Domain\RequestManagement\Entity\RequestedEntityInterface::getEntity()
|
||||
@ -178,7 +168,7 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriding is neccessary to declare the correct relation
|
||||
* Overriding is neccessary to declare the correct relation.
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*
|
||||
@ -193,7 +183,6 @@ class RequestedEntity extends AbstractEntity implements RequestedEntityInterface
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \App\Attribut\ClassAttributInterface::getClass()
|
||||
|
@ -21,6 +21,11 @@ interface RequestedEntityInterface extends EntityInterface, SlugAttributInterfac
|
||||
*/
|
||||
public function setIdentity($identity): void;
|
||||
|
||||
/**
|
||||
* @return bool True if an identity attribut is defined
|
||||
*/
|
||||
public function hasIdentity(): bool;
|
||||
|
||||
/**
|
||||
* @return EntityInterface
|
||||
*/
|
||||
|
@ -73,7 +73,8 @@ class RequestedEntityTest extends TestCase
|
||||
$requestedEntity->setClass(AbstractSource::class);
|
||||
}
|
||||
|
||||
public function testSetClass():void{
|
||||
public function testSetClass(): void
|
||||
{
|
||||
$class = AbstractSource::class;
|
||||
$entityMock = $this->createMock(EntityInterface::class);
|
||||
$repository = $this->createMock(RepositoryInterface::class);
|
||||
|
Loading…
x
Reference in New Issue
Block a user