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
2
votes
2 answers

INNER JOIN in DQL in Doctrine 2 / Zend Framework 2

I have an issue with DQL in Doctrine 2. Subqueries seem to be unavailable in DQL, so I don't know how to transform : SELECT DISTINCT a.ID_DOMAINE, L_DOMAINE, b.ID_SS_DOMAINE, L_SS_DOMAINE, c.ID_COMPETENCE, L_COMPETENCE FROM…
Kiruchi
  • 195
  • 3
  • 13
2
votes
1 answer

Customizing layout to sfWidgetFormDoctrineChoice

I am using Symfony 1.4 sfWidgetFormDoctrineChoice I have added the checkboxes to the form, which pulls the Model data successfully. What I want to do is also include a thumbnail next to the checkbox, along with the…
Carey Estes
  • 1,534
  • 2
  • 31
  • 59
2
votes
1 answer

Symfony2: deleted property still used in query

I deleted a property (teaser) from an enitiy (sale). I used the CLi to update the database & entites: $ php app/console doctrine:schema:update --complete --force $ php app/console doctrine:generate:entities Our --no-backup $ php app/console…
Andresch Serj
  • 35,217
  • 15
  • 59
  • 101
2
votes
1 answer

Doctrine 2 query builder vs entity persist performance

Summary: which is quicker: updating / flushing a list of entities, or running a query builder update on each? We have the following situation in Doctrine ORM (version 2.3). We have a table that looks like this cow wolf elephant koala and we would…
mogoman
  • 2,286
  • 24
  • 28
2
votes
3 answers

select query and count based on condition

I want to select all categories, subcategories and count the number of business that belongs to subcategory. this is the SQl query i am using. SELECT c.id, c.name, c.slug, sc.id, sc.name, sc.slug, COUNT(bsc.id) AS…
Ibrahim Azhar Armar
  • 25,288
  • 35
  • 131
  • 207
2
votes
0 answers

Doctrine_Query, criteria as objects, & the Visitor Pattern. Possible?

I've been working on a bunch of projects lately with Doctrine 1.2 integrated into Zend Framework 1.11, and it has been really fun. One of the most common methods I have implemented in my service layers are methods which returns a collection of my…
2
votes
1 answer

How to write a Doctrine Query with multiple conditions?

I am trying to write a doctrine query that meets the following conditions: published = 1 AND subsection = "gui" OR "lvo" OR "tnn" OR "wer" This is what I have: $getPrograms = Doctrine::getTable('Program') ->createQuery() ->where('published=?',…
Carey Estes
  • 1,534
  • 2
  • 31
  • 59
2
votes
1 answer

How do I query for all items which have a specific item embeded in doctrine odm

I have Comments for something and it's possible to like them. The likes are saved in the Comments as EmbedMany(targetDocument=User). I want to query for all Comments a Specific User has liked, how do I do that? I thought of something…
Senči
  • 911
  • 2
  • 10
  • 25
2
votes
1 answer

Why is "s.d IS NULL" being added to my where clause using DQL in Doctrine 1.1.2 (USING leftJoin)?

I am using a MySQL database and Doctrine 1.1.2. I am trying to write a query with a leftJoin and I am trying to understand the result as it has given me problems multiple times. After I have run a few different tests, it seems almost intermittent,…
2
votes
1 answer

Doctrine 2: Find by entity with composite primary key

I have two entity classes, Product and OrderEntry, defined like this (some annotations left out for compactness): class Product { /** * @Id */ protected $id; /** * @Column() * @Id */ protected $prodNumber; /** …
chiborg
  • 26,978
  • 14
  • 97
  • 115
2
votes
2 answers

Doctrine Full outer join

I would like to do a full outer join in Doctrine ORM(PHP) My current query is : $query = Doctrine_Query::create() ->from('Model_Contract_Payment p') ->innerJoin('p.Contract c') ->where(" c.modified_date IS NOT…
Vimalnath
  • 6,373
  • 2
  • 26
  • 47
1
vote
2 answers

symfony 1.4 reading relation 1:n doctrine

I want obtain the relations with two tables. This is my schema.yml Oferta: columns: titol: { type: string(50), notnull: true } sub_titol: { type: text } data_inici: { type: date } data_fi: { type: date } Opcions: columns: …
1
vote
1 answer

Confused using DQL with Doctrine2 entities and Zend framework

I have 4 entities : Country, Region, Province, Town.
dimbo
  • 817
  • 1
  • 11
  • 25
1
vote
1 answer

doctrine 2 query if product equals to multiple categories

$categories= array(3,20,24); $qb = $this->em->createQueryBuilder(); $qb->select('p') ->from('\Entities\Productss', 'p') ->leftJoin('p.category', 'c') ->andWhere('p.id =?1') …
dean jase
  • 1,161
  • 5
  • 23
  • 38
1
vote
1 answer

VSCode Doctrine DQL Support

I recently switch to vsCode, and I'm facing to a little problem. PHP Intelephense works well for php and symfony completion, but when I wrote DQL / Query Builder I didn't have autocomplete of the field of entity : $qb ->select('u.id, u.field1,…
Warks
  • 37
  • 6