Questions tagged [doctrine-query]

Doctrine Query Language (DQL) is one of the Doctrine 2 ORM key features, it is the option to write database queries in a proprietary object oriented SQL dialect.

Doctrine Query Language (DQL) is one of the Doctrine 2 ORM key features, it is the option to write database queries in a proprietary object oriented SQL dialect. Inspired by Hibernates HQL, this provides developers with a powerful alternative to SQL that maintains flexibility without requiring unnecessary code duplication.

More about Doctrine ORM you could fine on the project site, here.

370 questions
1
vote
0 answers

Is it possible to select as an object that entity with no relation in DQL?

For example, there is a DQL that get some articles. $query = $this->getEntityManager()->createQuery(' SELECT a, t, u FROM MyArticleBundle:Article a LEFT JOIN a.tags t LEFT JOIN a.author u WHERE a.id IN (1,2,3) ORDER BY a.id…
R.Atim
  • 367
  • 1
  • 7
  • 16
1
vote
1 answer

Make a filter query search multiple columns | Symfony 1.4

I am working on an Symfony 1.4 project and need to customize a backend filter "name", so that the column "name_full" is searched simultaneously with the "name" column. I thought of doing it like that in my FormFilterClass: public function…
Florian Lucke
  • 109
  • 2
  • 11
1
vote
2 answers

Doctrine2: createQueryBuilder which has an innerJoin with more than one condition

I basically want to do this SQL statement: SELECT * FROM Table1 JOIN Table2 ON ( Table2.ID = Table1.THIS_ID OR Table2.ID = Table1.THAT_ID ) Using createQueryBuilder and NOT createQuery. Is it possible? All the examples I can find only deal with a…
Adi
  • 742
  • 7
  • 22
1
vote
1 answer

how to do a post listing with tag filter with symfony2

I have this very usual question. but I spent a lot of time cannot solve. I am using symfony2 with doctrine. any help? appreciate let say I have 3 entities: Post, Tag, PostTag Post has many Tags Tag has many Posts I need to do a Post listing filter…
Elliot Yap
  • 1,076
  • 1
  • 12
  • 20
1
vote
1 answer

Doctrine 2 - Hydratation from stored procedure

I have little problem with stored procedure (pgsql). In the return of this procedure, the array return has special construction that unusable for me in this way. I try many different way to call the SP or Hydratation method but always same kind of…
1
vote
1 answer

Doctrine Datetime and where condition

I am writing a Doctrine 2.3 Query and I am facing some issues: The SQL Query which I am reflecting was: SELECT * FROM `entry` WHERE `plate` LIKE '%' AND `recognition_datetime` BETWEEN '2013-03-13 22:20:18' AND '2013-03-13 22:20:20'; I am…
DonOfDen
  • 3,968
  • 11
  • 62
  • 112
1
vote
0 answers

Doctrine - Postgresql database driver Uncaught exception

i' m trying to setting up CodeIgniter - Doctrine with Postgresql database. I've changed the $db['default']['dbdriver'] to 'pgsql', following the instructions at…
theochry
  • 11
  • 2
1
vote
1 answer

Doctrine query buider with a where clause for a related entity field

I have two entities: Image and Tags, with a many-to-many relationship. Image has some fields: code, description, author and tags which implements the many-to-many relationship. Tag has just two fields: name and images. I'm building a very general…
Waiting for Dev...
  • 12,629
  • 5
  • 47
  • 57
1
vote
1 answer

How can I make a Symfony2 entity field that gets its list of entities from a relation?

I have 3 entities: Company, Department, and User User has a one to many relationship to company. Department has separate many to one relationships with both Company and User The goal is for each department to have different departments configured,…
MrGlass
  • 9,094
  • 17
  • 64
  • 89
1
vote
2 answers

How do I perform relational division using DQL?

When trying to perform relational division using Doctrine 1.2, I receive a "Duplicate alias" error over what seems like the DISTINCT found in the query below: SELECT Data.ID FROM Data INNER JOIN TaggedData ON (Data.id =…
Alexander Trauzzi
  • 7,277
  • 13
  • 68
  • 112
1
vote
1 answer

Join queries in Doctrine on tables without specified relations

I have two tables that do not have a relation defined with each other in the schema.yml. However, table 1 has a foreign key reference to the primary key of table 2. Clearly, I goofed up by not designing the database well, but now it's mitigation…
user1020069
  • 1,540
  • 7
  • 24
  • 41
1
vote
1 answer

Selecting entities associated with two other entities, joining three tables in Doctrine2

I have three types of entities, Users Groups Websites Users can have Websites, and they also can belong to Groups Each of these entities has a name as well. Here are my Doctrine2 definitions:
Yasser1984
  • 2,401
  • 4
  • 32
  • 55
0
votes
2 answers

Namespaced Doctrine entity name is misconstrued during parsing

I have a bit of Doctrine ORM code like so: $query = $this->entityManager->createQuery('SELECT c FROM specialty\models\entities\Clan c WHERE c.Id = ?1'); This code has worked without a problem for ages. I recently reinstalled my LAMP stack…
pi.
  • 1,441
  • 3
  • 19
  • 25
0
votes
2 answers

Emailng-list based on query beeing updated automaticcaly from that query

i have emailing-list(based on some params) being automatically updated from an existing query. I explain : I have an emailing list (containing only email addresses) called "new users list" that will automaticcaly be updated whenever there are new…
ProXamer
  • 377
  • 1
  • 9
  • 25
0
votes
1 answer

Doctrine query not executing

trying to execute a Doctrine query that is invariably not happening: The code I have: $q = Doctrine_Query::Create()->select('l.lid')->from('lessons l')->where('l.topic =?','Title of topic') $result = $q->fetchOne() ; The funny thing is, this…
user1020069
  • 1,540
  • 7
  • 24
  • 41