Skip to content

Selecting nodes based on association doesn't work #682

@wouterj

Description

@wouterj

According to the documentation this code should work to select a node based on an association:

$number = $dm->find('MyProject\Domain\Phonenumber', '/path/to/phone/number');
$user = $dm->getRepository('MyProject\Domain\User')->findOneBy(array('phone' => $number->getUuid()));

However, when using this code to get a MenuNode documentation with a specific content object, I get an error:
The code

$dm = $this->get('doctrine_phpcr')->getManager();
$contentUuid = $dm->getPhpcrSession()->getItem('/cms/content/home')->getPropertyValue('jcr:uuid');

$dm->getRepository(MenuNode::class)->findOneBy(['content' => $contentUuid]);

The error

Cannot use association property "content" of class "...\MenuNode" as a dynamic operand

The docs seem to be incorrect.

More importantly, I can't find a way to select the node. The QueryBuilder can't help with this either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions