ATTENTION: This operation should not be executed in a production environment.
Creating database schema...
[Doctrine\ORM\Tools\ToolsException]
Schema-Tool failed with Error 'An exception occurred while executing 'CREATE TABLE dogs (id INT AUTO_INCREMENT NOT NULL, post_id: INT DEFAULT NULL, farm VARCHAR(50) NOT NULL, b
irthday DATE NOT NULL, sex TINYINT(1) NOT NULL, father VARCHAR(255) NOT NULL, mother VARCHAR(255) NOT NULL, weight DOUBLE PRECISION NOT NULL, INDEX IDX_353BEEB3269DD3DF (post_i
d:), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB':
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 synta
x to use near ': INT DEFAULT NULL, farm VARCHAR(50) NOT NULL, birthday DATE NOT NULL, sex TINYI' at line 1' while executing DDL: CREATE TABLE dogs (id INT AUTO_INCREMENT NOT NU
LL, post_id: INT DEFAULT NULL, farm VARCHAR(50) NOT NULL, birthday DATE NOT NULL, sex TINYINT(1) NOT NULL, father VARCHAR(255) NOT NULL, mother VARCHAR(255) NOT NULL, weight DO
UBLE PRECISION NOT NULL, INDEX IDX_353BEEB3269DD3DF (post_id:), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB
[Doctrine\DBAL\DBALException]
An exception occurred while executing 'CREATE TABLE dogs (id INT AUTO_INCREMENT NOT NULL, post_id: INT DEFAULT NULL, farm VARCHAR(50) NOT NULL, birthday DATE NOT NULL, sex TINY
INT(1) NOT NULL, father VARCHAR(255) NOT NULL, mother VARCHAR(255) NOT NULL, weight DOUBLE PRECISION NOT NULL, INDEX IDX_353BEEB3269DD3DF (post_id:), PRIMARY KEY(id)) DEFAULT C
HARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB':
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 synta
x to use near ': INT DEFAULT NULL, farm VARCHAR(50) NOT NULL, birthday DATE NOT NULL, sex TINYI' at line 1
[PDOException]
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 synta
x to use near ': INT DEFAULT NULL, farm VARCHAR(50) NOT NULL, birthday DATE NOT NULL, sex TINYI' at line 1
public function addAction(HttpFoundation\Request $request)
{
$post = new Entity\Post();
$form = $this->createForm(new Form\PostType(), $post);
if( $request->isMethod('POST') && $form->bind($request)->isValid() ) {
$post = $form->getData()->setAddDate();
$em = $this->getDoctrine()->getManager();
$em->persist($post);
$em->flush();
return $this->redirect($this->generateUrl('show', array('id' => $post->getId())));
}
return $this->render('SiteDeskBundle:Post:add.html.twig', array('form' => $form->createView()));
}
По сути моя начальная запись позволяла просто добавить несколько связей, и ничем не отличалась.