Skip to content

IBX-11842: Fixed SiteAccessAwareEntityManager::find() ignoring lock mode and lock version#777

Open
alongosz wants to merge 2 commits into
4.6from
ibx-11842-siteaccess-aware-em-find-lock-mode
Open

IBX-11842: Fixed SiteAccessAwareEntityManager::find() ignoring lock mode and lock version#777
alongosz wants to merge 2 commits into
4.6from
ibx-11842-siteaccess-aware-em-find-lock-mode

Conversation

@alongosz

@alongosz alongosz commented Jul 8, 2026

Copy link
Copy Markdown
Member
🎫 Issue IBX-11842

Related PRs:

  • ibexa/taxonomy#423

Description:

Ibexa\Core\Persistence\Doctrine\SiteAccessAwareEntityManager::find() declared only ($className, $id), silently dropping the $lockMode and $lockVersion parameters of Doctrine's EntityManager::find(). Any caller requesting a pessimistic lock, e.g. $em->find(TaxonomyEntry::class, $id, LockMode::PESSIMISTIC_WRITE), got no lock and no error — the intended SELECT … FOR UPDATE was never executed. Discovered while investigating IBX-11842 (taxonomy nested-set insert deadlocks), where the pessimistic lock was silently skipped.

The method now accepts and forwards both parameters to the wrapped entity manager, matching Doctrine\ORM\Decorator\EntityManagerDecorator::find().

The rest of the decorator was audited against the interface: no other method narrows its signature (refresh() already forwards $lockMode, lock() forwards all arguments).

A scoped PHPStan ignoreErrors entry was added, because Doctrine\Persistence\ObjectManager::find() declares only two parameters in both persistence v2 and v3 — the same false-positive class as the existing clear() entry in phpstan-baseline-doctrine-persistence-v3.neon.

For QA:

Covered by unit tests. Functional check: according to IBX-11842 steps, together with ibexa/taxonomy#423 PR.

Regression run:

alongosz and others added 2 commits July 8, 2026 15:30
The decorator narrowed EntityManagerInterface::find() to two
parameters, so callers requesting a pessimistic or optimistic lock
(e.g. LockMode::PESSIMISTIC_WRITE) silently got no lock and no error.
The arguments are now forwarded to the wrapped entity manager, the
same way Doctrine\ORM\Decorator\EntityManagerDecorator does.

Added a scoped PHPStan ignore, as ObjectManager::find() declares only
two parameters in both doctrine/persistence v2 and v3.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants