Skip to content

BUG: Repository Proxy dependency injection failure call createQueryForType() on null #3502

@Jan3k3y

Description

@Jan3k3y

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

After updating Neos Flow to versions 8.3.13 and higher, a critical dependency injection failure occurs in extended repository classes during proxy class initialization.

Error Message:

Fatal error: Call to a member function createQueryForType() on null
in /var/www/html/Packages/Framework/Neos.Flow/Classes/Persistence/Repository.php:137
Stack Trace Pattern:

Neos\Flow\Persistence\Repository::createQuery()
Neos\Flow\Persistence\Repository::__call("Flow_Aop_Proxy_buildMethodsAndAdvicesArray", array)
[CustomRepository]::Flow_Aop_Proxy_buildMethodsAndAdvicesArray()
[CustomRepository]::__construct()
The @flow\Inject annotated $persistenceManager property remains null, causing method calls on it to fail.

Expected Behavior

  • Custom repositories extending core repository classes should initialize properly
  • Dependency injection should work correctly for PersistenceManagerInterface and other injected dependencies
  • Applications should function normally after Flow framework updates
  • No breaking changes in dependency injection behavior between minor versions

Steps To Reproduce

  • Create a custom repository extending a core repository:
<?php
namespace Vendor\Package\Repository;

use Neos\Flow\Annotations as Flow;
use Neos\Flow\Persistence\PersistenceManagerInterface;

/**
 * @Flow\Scope("singleton")
 */
class CustomNodeDataRepository extends \Neos\ContentRepository\Domain\Repository\NodeDataRepository
{
    /**
     * @Flow\Inject
     * @var PersistenceManagerInterface
     */
    protected $persistenceManager;
    
    public function customMethod(): void
    {
        // Custom implementation
    }
}
  • Inject the custom repository in a controller or service:
/**
 * @Flow\Inject
 * @var \Vendor\Package\Repository\CustomNodeDataRepository
 */
protected $customRepository;
  • Update Neos Flow from 8.3.12 to 8.3.13+
  • Clear all caches: ./flow flow:cache:flush --force
  • Access any page/endpoint that triggers the custom repository usage

Result: Fatal error occurs during repository instantiation.

Environment

Working: Neos Flow 8.3.12 and earlier
Broken: Neos Flow 8.3.13 through 8.3.28 (current)

Anything else?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions