symfony2 doctrine allow null values?

I’ve just been looking for the solution, and wasn’t happy with the accepted solution. [Edit: though I now know it’s because I was using annotation]. The way I’ve found that works for me is setting nullable: /** * @ORM\Column(type=”varchar”, nullable=true) */ private $totaltime = null;

Complex WHERE clauses using the PHP Doctrine ORM

From my experience, each complex where function is grouped within parenthesis (I’m using Doctrine 1.2.1). $q->where(‘name = ?’, ‘ABC’) ->andWhere(‘category1 = ? OR category2 = ? OR category3 = ?’, array(‘X’, ‘X’, ‘X’)) ->andWhere(‘price < ?’, 10) produces the following SQL: WHERE name=”ABC” AND (category1 = ‘X’ OR category2 = ‘X’ OR category3 = ‘X’) … Read more

pass array of conditions to doctrine expr()->orx() method

I hope so, then I found this : $conditions = array(‘e.type = x’, ‘e.type = Y’, ‘e.type = N’); $orX = $qb->expr()->orX(); foreach ($conditions as $condition) { $orX->add($condition); } $qb->add(‘where’, $orX); Using @meze suggestion, you can simplify the code and replace the foreach statement with: $orX->addMultiple($conditions);

Symfony2 $user->setPassword() updates password as plain text [DataFixtures + FOSUserBundle]

Since you are using FOSUserBundle, you can use UserManager to do this. I would use this code (assuming you have $this->container set): public function load(ObjectManager $manager) { $userManager = $this->container->get(‘fos_user.user_manager’); $userAdmin = $userManager->createUser(); $userAdmin->setUsername(‘System’); $userAdmin->setEmail(‘system@example.com’); $userAdmin->setPlainPassword(‘test’); $userAdmin->setEnabled(true); $userManager->updateUser($userAdmin, true); }

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