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

  • Home
  • SEARCH
  • 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 5943889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:27:36+00:00 2026-05-22T16:27:36+00:00

my szenario in detail, iv’e got one User Document: /** @Document(collection=user) */ class User

  • 0

my szenario in detail, iv’e got one User Document:

/** @Document(collection="user") */
class User
{
    /** @Id */
    private $id;

    /** @ReferenceMany(targetDocument="Pet") */
    private $pet;

    public function getPet()
    {
        return $this->pet;
    }
}

and iv’e got one Pet document:

/** @Document(collection="pet") */
class Pet
{
    /** @Id */
    private $id;

    /** @ReferenceMany(targetDocument="User") */
    private $user;

    public function getUser()
    {
        return $this->user;
    }
}

A many to many correlation. If i call the following code for an existing document…

$result = $this->_dbContainer->getDocumentManager()->getRepository('User')->findBy(array('id' => => 'XZTZHJ323LKFHGJKLHGFGHJK'));
print_r($result->toArray());

…it ends in an endless loop. Error message:

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 112721921 bytes) in ...

If i execute the following code:

var_dump($result->count());

The result ist one / it exist (everything ok). A var_dump of $result->current() is NULL. The method getMongoData returns the following data (which is correct):

Array ( [0] => Array ( [$ref] => example [$id] => MongoId Object ( [$id] => 4ddac7667294c79e17000002 ) [$db] => test ) )

If i execute the following code:

var_dump($result->current());

The result is boolean (false).

Any ideas?

  • 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-05-22T16:27:37+00:00Added an answer on May 22, 2026 at 4:27 pm

    Provided your model looks something like this

    /**
     * @Document
     */
    class User
    {
        /** @Id */
        private $id;
    
        /** @ReferenceMany(targetDocument="Something") */
        private $somethings;
    
        public function __construct()
        {
            $this->somethings = new \Doctrine\Common\Collections\ArrayCollection;
        }
    
        public function getSomethings()
        {
            return $this->somethings;
        }
    }
    

    You should be able to retrieve the referenced models using

    $user = $dm->find('User', $id);
    $somethings = $user->getSomethings();
    $firstSomething = $somethings->current(); // will return false if empty, can also use first()
    foreach ($somethings as $something) {
        // and so on
    }
    

    Do not attempt to var_dump() or print_r() the model proxy objects. These contain many recursive references and you will exhaust your available memory attempting to render them as output.

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

Sidebar

Related Questions

I have the following scenario jQuery('#content').fadeOut('slow',function(){ jQuery('#content').load(detail.php?product=+imgID+&category=+cat); jQuery('#content').fadeIn('fast'); }); My problem however is that
I plan to create a typical Master-Detail scenario, i.e. a collection of items displayed
I have a master-detail scenario where I have 1 ComboBox listing companies from an
I am designing database tables for a master-detail scenario. The specific requirement is that
I am using Microsoft SQL Server and I have a master-detail scenario where I
Scenario: I'm currently writing a layer to abstract 3 similar webservices into one useable
I am learning ASP.NET and I have a master-detail scenario using two GridViews in
I currently have created a pagination JavaScript class that will automatically paginate comments when
Here is the deal. I have a Master-Detail Grid scenario. The Master GridView is
I have a Master-Detail relationship implemented with two Datagridview controls in c#. The datasources

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.