Skip to content

Commit

Permalink
Fixed the table method's param type.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslanbaidan committed Mar 23, 2024
1 parent 5acb04c commit 56c1f30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/Service/ObjectObjectService.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ public function shiftPositionInComposition(int $id, array $data): void
$positionToBeSet = $data['move'] === static::MOVE_COMPOSITION_POSITION_UP
? $objectObject->getPosition() - 1
: $objectObject->getPosition() + 1;
$previousObjectCompositionLink = $this->objectObjectTable->findByParentObjectAndPosition(
$objectObject->getParent(),
$positionToBeSet
);
/** @var MonarcObject $parentObject */
$parentObject = $objectObject->getParent();
$previousObjectCompositionLink = $this->objectObjectTable
->findByParentObjectAndPosition($parentObject, $positionToBeSet);
/* Some positions are not aligned in the DB, that's why we may have empty result. */
if ($previousObjectCompositionLink !== null) {
$this->objectObjectTable->save(
Expand Down
3 changes: 2 additions & 1 deletion src/Table/ObjectObjectTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Monarc\Core\Table;

use Doctrine\ORM\EntityManager;
use Monarc\Core\Entity\MonarcObject;
use Monarc\Core\Entity\ObjectObject;
use Monarc\Core\Table\Interfaces\PositionUpdatableTableInterface;
use Monarc\Core\Table\Traits\PositionIncrementTableTrait;
Expand All @@ -21,7 +22,7 @@ public function __construct(EntityManager $entityManager, string $entityName = O
parent::__construct($entityManager, $entityName);
}

public function findByParentObjectAndPosition(ObjectObject $parentObject, int $position): ?ObjectObject
public function findByParentObjectAndPosition(MonarcObject $parentObject, int $position): ?ObjectObject
{
return $this->getRepository()->createQueryBuilder('oo')
->where('oo.parent = :parentObject')
Expand Down

0 comments on commit 56c1f30

Please sign in to comment.