forsberg
forsberg

Reputation: 1913

Doctrine problematical on prod, but not dev

I earlier tested Symfony's web app on both local computer and target host in both environments: prod and dev - both worked fine. So I finished a mile stone on my local computer, still testing only on dev. Everything works fine. However - Doctrine seems to not working on prod now - and I don't know why and how it stopped working.

Here's what I see - this code (from DefaultController.php) is working on both, prod and dev:

    $tags = $this->getDoctrine()
            ->getRepository("MyWebBundle:Tag");

But this (one line more) is working only on dev, but not prod:

    $tags = $this->getDoctrine()
            ->getRepository("MyWebBundle:Tag")
            ->find(1);

In prod the last line causes "die" to the webpage. There's no doubt that an error occured, but I have no any message in log, and of course in prod env Symfony is silent. I have no idea how to approach this problem... The most weird thing is that prod worked earlier properly.

UPDATED: Ok, I traced the part of code which makes a difference of working and not working (but in prod, in dev always works). There are some relations in database (Tag Many-to-One to Category). Here is this part of code in Entity/Tag.php:

/**
* @ORM\ManyToOne(targetEntity="Category")
* @ORM\JoinColumn(name="id_category", referencedColumnName="id_category", nullable=true)
*/
protected $category;

It's interesting that Symfony2 is not verbose about it... When I delete it from Tag.php, my webapp works. If I re-type it into this file, it doesn't...

UPDATED: After further research I can see that actually all relations are problematical (in prod, not in dev). I wrote additional "artificial" (for test purposes) queries to database - in a fashion as above, and all give one of two effects: When table is on top of hierarchical dependencies, everything works (let's call it A type) *When table has relations, Symfony just stop working without any message (let's call it B type...*

I also tried to make a test with empty table and with fulfilled one. Two cases are following in "B-type" tables: When empty, it works *When data are stored (with relations), it doesn't work*

Upvotes: 2

Views: 2494

Answers (1)

Vitalii Zurian
Vitalii Zurian

Reputation: 17976

In your app.php change

$kernel = new AppKernel('prod', false);

to

$kernel = new AppKernel('prod', true);

This will boot your application with prod environment and with enabled debugging

Upvotes: 5

Related Questions