mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 23:53:50 +00:00
Implement context-specific voters for all current entities that can be linked to a document
For reusability an AbstractStoredObjectVoter was created and a StoredObjectVoterInterface. A WorkflowDocumentService checks whether the StoredObject is involved in a workflow.
This commit is contained in:
@@ -99,6 +99,22 @@ class EntityWorkflowRepository implements ObjectRepository
|
||||
return $this->repository->findAll();
|
||||
}
|
||||
|
||||
public function findByRelatedEntity($entityClass, $relatedEntityId): ?EntityWorkflow
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('w');
|
||||
|
||||
$query = $qb->where(
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->eq('w.relatedEntityClass', ':entity_class'),
|
||||
$qb->expr()->eq('w.relatedEntityId', ':entity_id'),
|
||||
)
|
||||
)->setParameter('entity_class', $entityClass)
|
||||
->setParameter('entity_id', $relatedEntityId);
|
||||
|
||||
return $query->getQuery()->getResult();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed|null $limit
|
||||
* @param mixed|null $offset
|
||||
|
Reference in New Issue
Block a user