Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Can't write to the db

Hi I have the following function:

public function addAction($name,$rating=null,$address,$city,$district=null ,$description=null){

       echo "processing";
       $chat= new Chat();


       echo "till here";

       $institution= new Institution();
       echo "wb here";
   }catch (ErrorException $e){
       echo $e;



The output I have when I go thru the defined toute is only "processing" (the first 'echo") , nothing is added to the db. I figure out where the mistake can be.


hi, try this:

if($chat->save() == false)
foreach($chat->getMessages() as $mes)
        echo $mes;


edited Dec '16

If you are on developer machine you could remove try catch block and see php error information and line in your browser, and, assuming you have xdebug, much more. If you don't, I suggest you take some time to install it.

Otherwise you can use:

echo ($e->getCode());

inside catch.