dql Questions

1

Solved

This code: $builder->select('p') ->from('ProProposalBundle:Proposal', 'p') ->leftJoin('ProProposalBundle:Proposal:Vote', 'v') ->leftJoin('ProUserBundle:User', 'u') ->andWhere('v...
Consent asked 26/3, 2014 at 10:32

4

Solved

I want to retrieve all the files from a cabinet (called 'Wombat Insurance Co'). Currently I am using this DQL query: select r_object_id, object_name from dm_document(all) where folder('/Wombat In...
Groveman asked 21/1, 2014 at 2:36

2

Solved

I'm trying to create a form with data in collection type depending on the user being logged. I'm following this chapter of the Symfony cookbook. Everything works fine when the query_builder option...
Bronchitis asked 16/7, 2013 at 12:39

1

My Entity directory for my bundle is getting quite large. I'd like to be able to group my classes into sub-directories. For example, all forum related classes in Entity/Forum/. I've been able to do...
Outsert asked 10/1, 2014 at 19:0

0

So we have such dql $oQuery = $this->createQueryBuilder('assets') ->addSelect('flags') ->addSelect('types') ->addSelect('groups') ->leftJoin('Site\MainBundle\Entity\123\invFlag...
Lacey asked 21/11, 2013 at 23:22

3

Solved

I try to execute this query in my CompanyRepository $qb = $this->_em->createQueryBuilder(); $qb->select(array('c', 'ld')) ->from('Model\Entity\Company', 'c') ->leftJoin('c.legalde...
Endocardial asked 20/1, 2012 at 9:24

1

Solved

I wish to fetch an entity where the inversed association does not exist (on a 1:1 association) I get the error: A single-valued association path expression to an inverse side is not supported i...
Terminal asked 5/8, 2013 at 12:16

4

Solved

Can someone provide me a couple clear (fact supported) reasons to use/learn DQL vs. SQL when needing a custom query while working with Doctrine Classes? I find that if I cannot use an ORM's built...
Cashew asked 17/7, 2012 at 20:29

1

Solved

How can I get the difference between 2 dates with Dql? I have tried the following code, but that didn't work. $query =$this->_em->createQuery('select a,DATEDIFF(d,\'now\',a.date) from ABund...
Kibitz asked 2/6, 2013 at 0:14

5

I have two classes - Page and SiteVersion, which have a many to many relationship. Only SiteVersion is aware of the relationship (because the site is modular and I want to be able to take away and ...
Klaraklarika asked 25/3, 2011 at 12:28

3

Solved

How can I select all items from one specific author ? Its possible this way ? Or how can I edit entities if I want many item types and item packages (item has many items) too ? Item /** * @ORM\T...
Bottoms asked 13/2, 2013 at 10:39

1

Solved

I have a standard many-to-many relationship set up. Entity A can have many of Entity B, and vice versa. I'm trying to get a list of all Entity A that do NOT have any corresponding Entity B. In SQL...
Prototherian asked 19/1, 2013 at 18:17

1

Solved

I have an entity named Auction with two fields of type datetime: date1 and date2. I would like to SELECT all Auction rows where the difference between date1 and date2 is less then 30 minutes. How c...
Hackneyed asked 8/1, 2013 at 13:48

1

I get a strange error when I execute this DQL query: SELECT u FROM User u LEFT JOIN u.schedule s WHERE DATE(s.timestamp) = DATE(NOW()) The exception is thrown by Doctrine with the message: Expe...
Sciurine asked 7/11, 2012 at 14:58

2

Solved

I'm working with symfony and I would like to know how I can do a simple insert using the doctrine:dql task. ./symfony doctrine:dql "<what should I put here?>"
Messeigneurs asked 22/6, 2011 at 16:27

3

Solved

I wonder how to get a random number of Members from a Group, but I do not know what is the best way to do this, and I think ORDER BY RAND() is not the best alternative, as a Group can have more tha...
Simas asked 17/9, 2011 at 13:57

2

Solved

I have my two classes User and Role, and I need to make a QueryBuilder which returns a query for the users who have the ROLE_PROVIDER role. I need this for an entity form field in Symfony 2. In the...
At asked 14/4, 2012 at 0:25

1

Solved

I am trying to use the DATE_ADD function from doctrine2 but I am having trouble get it right. I am using like this in DQL: ->andWhere('p.created_at <= DATE_ADD(CURRENT_DATE(),4, day)') bu...
Since asked 10/12, 2012 at 12:56

1

How to write a following SQL query in doctrine2 as DQL . SELECT COUNT(id) FROM stats WHERE YEAR(record_date) = 2009 GROUP BY YEAR(record_date), MONTH(record_date) i.e i would like to group by...
Harber asked 17/9, 2011 at 12:58

1

Solved

What is the difference between JOIN ON and JOIN WITH in Doctrine2? I couldn't find any relevant info in the manual.
Neall asked 30/10, 2012 at 11:20

3

I know I have a syntax isse here however I cant figure it out. I'm trying to do a SELECT and INNER JOIN of 5 tables but Symfony is complaining about the Entities in the JOIN are used before being d...
Knapsack asked 22/2, 2012 at 16:58

1

I have joined table inheritance (lets call it Action) and I need to get all records of Action that satisfy the condition, but the fields are in sub-classes ? Is there way to access sub-class fields...
Sestertium asked 21/3, 2012 at 18:22

2

Solved

I'm having trouble crafting a fairly simple query with Doctrine... I have two arrays ($countries, $cities) and I need to check whether database record values would match any inside either. I'm loo...
Pend asked 26/2, 2010 at 18:10

1

Solved

I would like to perform a SELECT from the results of a subquery in DQL. The equivalent of doing the following in SQL: SELECT * FROM ( SELECT foo1,foo2 FROM bar ) where foo1='something'; The prob...
Raffle asked 22/3, 2012 at 23:19

1

Say I have the following classes: class Store { /** * @ManyToMany(targetEntity="PaymentMethod") */ protected $paymentMethods; } class PaymentMethod { } When we delete (or just disable, with...
Caspar asked 10/2, 2012 at 10:47

© 2022 - 2024 — McMap. All rights reserved.