dear all,
i’m trying to build up a NeosFlow-application with serveral ManyToOne/OneToMany relations. i think i succeeded in using the correct parameters now, but php throws me now Memory size errors, so i do have the feeling to have circular references within my setup, but i have no idea where :((((
the database model is that way that i have a Library-Model, which has Topics as children, and these topics have questions, and and questions have answers, so
Library (1:n) Topic (1:n) Question (1:n) Answer
i’ve setup the following relations:
class Topic {
/**
* @var integer
* @ORM\Id
* @ORM\GeneratedValue(strategy=“AUTO”)
* @ORM\Column(name=“id”, type=“integer”, nullable=false)
*/
protected $id;/** * Library for this topic * @var Library * @ORM\ManyToOne(inversedBy="topics", cascade={"persist"}, fetch="EXTRA_LAZY") * @ORM\JoinColumn(name="library_id", referencedColumnName="id", nullable=false) */ protected $library;
}
and
class Library
{
/**
* @var integer
* @ORM\Id
* @ORM\GeneratedValue(strategy=“AUTO”)
* @ORM\Column(name=“id”, type=“integer”, nullable=false)
*/
protected $id;/** * Topics for this library * @var Collection<Topic> * @ORM\OneToMany(mappedBy="library", cascade={"persist"}, fetch="EXTRA_LAZY") */ protected $topics;
}
and similar to for all other relations.
-
if i’m running the action
public function showtopicAction($id) {
$t = $this->topicRepository->findById($id)->getFirst();
$this->view->assign(“topic”, $t);
}
i get the error “PHP Fatal error: Allowed memory size of 536870912 bytes exhausted” -
if i try to output the topic using the JsonView everything seems to be fine, i get the topic information
so my questions are:
- how to find out if there are circular references?
- is there some similar function to JsonView::setConfiguration() (to limit the output just to some fields and relations)???
ciao
H.