Apply class to Symfony2 Form Label

I’ve got it… <?php echo $view[‘form’]->label($form[‘first_name’], ‘First Name’, array( ‘label_attr’ => array(‘class’ => ‘control-label’), )) ?> Apparently “attr” is “label_attr” for labels fields. P.S. Corresponding twig code {{ form_label(form.first_name, ‘First Name’, { ‘label_attr’: {‘class’: ‘control-label’} }) }}

Persisting other entities inside preUpdate of Doctrine Entity Listener

I give all the credits to Richard for pointing me into the right direction, so I’m accepting his answer. Nevertheless I also publish my answer with the complete code for future visitors. class ProjectEntitySubscriber implements EventSubscriber { public function getSubscribedEvents() { return array( ‘onFlush’, ); } public function onFlush(OnFlushEventArgs $args) { $em = $args->getEntityManager(); $uow … Read more

Doctrine2: How to set all tables to collate with UTF8

The behavior of collate has changed in doctrine: http://www.doctrine-project.org/jira/browse/DDC-2139 The collation is now set to utf8_unicode_ci if you don’t specify anything at the table level. The way to go right now is to add it to options in your table declaration: /** * @ORM\Table(options={“collate”=”utf8_swedish_ci”}) * @ORM\Entity */ This will generate the correct collation for the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)