Given model Post
which has a field tags
which holds an array of strings, eg:
Post:
id: 1
tags: ['a', 'b', 'c']
Post:
id: 2
tags: ['a', 'z']
How to construct a query, to get models containing all values from array ['a', 'b']
(in this example, return only Post id 1)?
I've been thinking about these:
Useing Doctrine ODM QueryBuilder:
// is this correct?
$qb->expr()->field('tags')->all( array('a', 'b') );
Useing Doctrine ORM QueryBuilder:
$qb->expr()->all( /* the docs say to use DQL here.. is there no QueryBuilder alternative? */ )