Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/05/2013, 14:57
wilmer30
 
Fecha de Ingreso: enero-2010
Mensajes: 491
Antigüedad: 14 años, 3 meses
Puntos: 12
Respuesta: Error ainsertar registro con doctrine 2

Aclaro que Modifies y Created son de tipo DateTime, que tambien pueden aceptar NULL, cambie los valores asi:
Código PHP:
    public function nuevoRoles($datos){
        
$per = new ApplicationEntityRoles;
        
$per->setName($datos['name']);
        
$per->setDefault(true);
        
$per->setModified(new DateTime("now"));
        
$per->setCreated(new DateTime("now"));
        
$this->em->persist($per);
        
$this->em->flush();    
    } 
y el error:
Cita:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'default, modified, created) VALUES ('asdf', 1, '2013-05-22 22:46:39', '2013-05-2' at line 1' in C:\xampp\htdocs\bcbtram\library\Doctrine\DBAL\Stat ement.php:138