So I seem to be plagued by issues that only affect production mode in Symfony and not developer mode. This time, I have a ManyToOne association and I'm trying to fetch only the entities which do not have an association (i.e. they have a NULL value in the database). This works exactly as I'd expect in dev move, but in prod mode, Doctrine throws an "unrecognized field" exception... for a field which absolutely does exist.
Here's the relevant part of the entity in question (Page.php):
/**
* @ORM\ManyToOne(targetEntity="Project", inversedBy="pages")
* @ORM\JoinColumn(name="project_id", referencedColumnName="ID")
*/
protected $project;
And here is the relevant line from the controller (PageController.php):
$pages = $this->getDoctrine()->getRepository('JCScopingBundle:Page')->findBy(['project' => null]);
Again, this works perfectly using app_dev.php (i.e. dev mode), but using app.php (i.e. prod mode) I keep getting the "unrecognized field" exception. What gives?
Update: I added a "weight" integer field to the same entity and that field is not recognized in prod
mode either. This means I can't use prod
mode, which means I can't upload my changes to the remote server. Really in a pickle here...
dev
environment and not inprod
it's being cached most of the time. Did youcache:clear --env=prod --no-debug
? – ccKepprod
cache folder through the GUI file system and then reload the page. I've done this more than once and gotten the same result. The last time I had aprod
-only issue it was a bug in Symfony that was eventually fixed by an official patch. – willherzogcreateQuery("SELECT page FROM JCScopingBundle:Page page WHERE p.project IS NULL")
?) – ccKeprequest.CRITICAL: Uncaught PHP Exception Doctrine\ORM\ORMException: "Unrecognized field: project" at ..\vendor\doctrine\orm\lib\Doctrine\ORM\ORMException.php line 101 {"exception":"[object] (Doctrine\\ORM\\ORMException(code: 0): Unrecognized field: project at ..\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\ORMException.php:101)"}
– willherzog