Hello,
I have an EntityManager (PilotManager class) and function:
/**
* Entity manager
* @var Doctrine\ORM\EntityManager;
*/
private $entityManager;
/**
* Constructor
*/
public function __construct($entityManager)
{
$this->entityManager = $entityManager;
}
public function addNewPilot($data)
{
// Create new Pilot entity
$pil = new Pilot();
$pil->setName($data['name']);
$pil->setCity($data['city']);
var_dump($pil);
// Add the entity to entity manager
var_dump($this->entityManager->persist($pil));
// Apply changes to database
var_dump($this->entityManager->flush());
echo 'x';
return $pil;
}
And something goes wrong while doing ->flush(), script stops on this command, but I don’t see any error in log and on stdout (however it’s configured and I can see any other errors, warnings and notices).
How can I receive SQL error and avoid script to return 200 (returns it now)?