Doctrine select with null

Is there a possibility to execute something like: $builder = $this->getEntityManager()->createQueryBuilder(); $builder->select( ‘f.id’, … ‘NULL AS missing_attribute’…

Aliasing fields using partial object syntax + array hydrator in doctrine 2

Is there any way to alias fields when using partial object syntax in Doctrine 2? I know I can do this: $this->createQueryBuilder(‘user’)->select([ ‘user.id AS id’, ‘user.firstName AS …

Symfony2 persist form collections with Doctrine UNIQUE INDEX and ORDER BY?

I have a User entity that has a collection of List Items associated with it. Each List Item entity also references another entity, Topic. I have setup a UNIQUE constraint on the List Item table that …

Doctrine2 find by value in field array

i wonder if there is a way to search for a document field looking like : /** * @var array * * @ORMColumn(name=”tags”, type=”array”, nullable=true) */ private $tags; which in database looks …

How can I get ID of entity in form type?

I have form type for build form of category: class CategoryType extends AbstractType { /** * @param FormBuilderInterface $builder * @param array $options */ public function …

Object-Relational Mapping vs Database Abstraction Layer

I’m using Doctrine which provides both ORM and DBAL. What is difference between them? How should one decide when to use which?

Default value of Doctrine ORM association

I have the entity (such as below). I want to set some default values while creating. As you can see in __construct, it is easy to set the $name (string), but how can I set the $group? (for example I …

Select entries between dates in doctrine 2

I will go insane with this minimal error that I’m not getting fix. I want to select entries between two days, the examples below ilustrate all my fails: opt 1. $qb->where(‘e.fecha > ‘ . $…

Doctrine 2: Load entity and childs count

I have these two entities: Message entity class Message { /** * @ManyToOne(targetEntity=”User”) * @JoinColumn(name=”author”, referencedColumnName=”id_user”) */ protected $author; …

How to force Doctrine to update array type fields?

I have a Doctrine entity with array type field: /** * @ORMTable() */ class MyEntity { (…) /** * @var array $items * * @ORMColumn( type=”array” ) */ private $…