Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8225071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:17:21+00:00 2026-06-07T15:17:21+00:00

I have a Doctrine entity Page which is loaded by module Foo . The

  • 0

I have a Doctrine entity Page which is loaded by module Foo. The page is a nested set provided by the Gedmo Doctrine Extension. The module Bar has another model Metadata, 1:1 related to a page. I would like to join the metadata directly when Foo loads the tree.

So inside module Foo:

$em->getRepository('My\Entity\Page')->getRootNodes();

This loads a collection of pages, but I’d like to have the metadata available directly. Because I trigger an event after loading the nodes, all modules can subscribe to this event and use the pages for whatever they want (in this case, meta data is required for a navigation structure, but navigation has nothing to do with module Foo, only with Bar).

The system must be kept modular, so Page has no dependency on Metadata. Is it somehow possible Bar listens to an event, building the query inside the repository? Then it adds an additional join to load the metadata of each page.

function getCalledOnEventTrigger($event)
{
    $q = $event->getQueryObject();
    $q->leftJoin('some join expression');
    // Query now joins metadata as well
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T15:17:23+00:00Added an answer on June 7, 2026 at 3:17 pm

    I finished this by using the Zend\EventManager I inject into my custom repository. This works, but still doesn’t work well because Doctrine must be aware of all relations, so the query I actually want to perform with the definitions in place, is impossible to execute. I solved it by adding the definitions nonetheless.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an entity Movie which has a unique constraint through doctrine annotation. Based
I have a service in which I inject the entity manager service (@doctrine.orm.entity_manager) because
I have an entity ArticlePattern , which has a property pattern (string). I need
I have a Doctrine Entity (News) which I listen for the event prePersist .
I have three Doctrine entities: Device, which has a OneToOne relationship with Device\Status, which
I have such doctrine entities: <?php namespace App\Entity; use Doctrine\Common\Collections\ArrayCollection; /** * @Entity(repositoryClass=App\Repository\Page) *
In my Doctrine entity, which is data_class for my form I have a file
I'm using symfony2 and have accessed an entity using a doctrine query, which I
I have a number of simple controller classes that use Doctrine's entity manager to
I have a 'vanilla' install of CodeIgniter 2 + Doctrine 2. My tutorial Entity.User.dcm.yml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.