-1

i am currently building subscription form with symfony 3 and all works like it should in development environment. Once i deploy it to production, all works fine at the beginning - data is pushed to database just like it should for the first subscriber. However when i close the website, open it again, complete the form and try to submit it - data is not pushed to DB. I do not get any particular error at that time, it looks like it is trying to push it to database but then something crashes on the background and i get completed for at the end.

That seem to be deployment issue to me but i cannot seem to figure out which one. I was deploying my app with deployer.org

When deploying i was getting this error "Unable to setup correct permissions for writable dirs. You need to configure sudo's sudoers files to not prompt for password, or setup correct permissions manually." I did not give it any special attention as my website did deploy and 1 user of the website did push to DB just fine.

I am using MySql as database

Any assistance is much appriciated.

Sky21.86
  • 627
  • 2
  • 9
  • 26
  • Check your var/logs/prod.log file, maybe an explicit error is displayed in it. – Chuck Norris Sep 05 '16 at 07:05
  • thanks for the tip @Chuck Norris - Just got over to my var/logs/prod.log file. The error that i am seeing there is "request CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\UndefinedMethodException: "Attempted to call an undefined method named "setId" of class "AppBundle\Entity\SubscriberDetails". Did you mean to call "getId"?"" The thing is that the id that this error is about is a unique identifier, that is being auto generated in AppBundle/Controller/Entity/SubscriberDetails + all works fine on my localhost so not sure what the error is here. – Sky21.86 Sep 05 '16 at 14:31
  • Try a clear cache on the prod environnement : php bin/console c:c -e=prod (or remove the folder prod inside var/cache/) – Chuck Norris Sep 06 '16 at 06:12
  • Hello Check Norris, tried all of the above and still does not work. – Sky21.86 Sep 07 '16 at 13:58

1 Answers1

0

Finally got this figured out. In my SubscriberDetails Entity I had id set up to be auto generated (e.g. @ORM\GeneratedValue(strategy="AUTO")) and for reasons i am not sure of and would like to find out this was working well on dev but was not working at all on prod. So solution to this was to remove auto generation from entity level and simulate it in controller via:

$query = $em ->createQuery('SELECT MAX(s.id) FROM AppBundle:SubscriberDetails s');
$newSubscriber ->setId($query->getSingleScalarResult() + 1);

That did the trick for me

Sky21.86
  • 627
  • 2
  • 9
  • 26