I use Symfony 2.3, and I get this exception when I try to list projects:
The target-entity Weber\ProjectBundle\Entity\SurveyUrl cannot be found in 'Weber\ProjectBundle\Entity\Project#surveyUrls'.
Simplification of my objects:
Project.php:
<?php namespace Weber\ProjectBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\ArrayCollection; class Project { protected $id; protected $respondents; protected $surveyUrls; public function __construct() { $this->respondents = new ArrayCollection(); $this->surveyUrls = new ArrayCollection(); } public function addRespondent(\Weber\ProjectBundle\Entity\Respondent $respondents) { $this->respondents[] = $respondents; return $this; } public function removeRespondent(\Weber\ProjectBundle\Entity\Respondent $respondents) { $this->respondents->removeElement($respondents); } public function getRespondents() { return $this->respondents; } public function addSurveyUrl(\Weber\ProjectBundle\Entity\SurveyUrl $surveyUrls) { $this->surveyUrls[] = $surveyUrls; return $this; } public function removeSurveyUrl(\Weber\ProjectBundle\Entity\SurveyUrl $surveyUrls) { $this->surveyUrls->removeElement($surveyUrls); } public function getSurveyUrls() { return $this->surveyUrls; } }
Respondent.php:
<?php namespace Weber\ProjectBundle\Entity; use Doctrine\ORM\Mapping as ORM; class Respondent { private $id; protected $project; public function setProject(\Weber\ProjectBundle\Entity\Project $project = null) { $this->project = $project; return $this; } public function getProject() { return $this->project; } }
and SurveyUrl.php:
<?php namespace Weber\ProjectBundle\Entity; use Doctrine\ORM\Mapping as ORM; class SurveyURL { private $id; protected $project; protected $respondent; public function setProject(\Weber\ProjectBundle\Entity\Project $project = null) { $this->project = $project; return $this; } public function getProject() { return $this->project; } public function setRespondent(\Weber\ProjectBundle\Entity\Respondent $respondent = null) { $this->respondent = $respondent; return $this; } public function getRespondent() { return $this->respondent; } }
I do not understand that before I created the SurveyUrl object, there were no problems at all, and both objects are almost identical in configuration.
Thanks for any help.
source share