dql Questions

5

Solved

Hi there I got a DQL that works (I get all my event since the beginning) : DoctrineHelper::getEntityManager()->createQueryBuilder() ->select("u.surname, count(u.surname) as total") ->fr...
Rident asked 12/8, 2011 at 9:42

2

Solved

I can't find anything related to using COLLATE in a DQL query with Doctrine (and ofcourse it doesn't seem to work). My specific problem: I have a table with utf8_general_ci charset. I have one sp...
Westphal asked 11/3, 2014 at 12:33

5

Solved

I have a doctrine query that returns blog posts and their comments: SELECT b, c FROM BlogPost b LEFT JOIN b.comments c I would like to limit the results to 10 blog posts. According to the DQL do...
Rochellerochemont asked 11/4, 2011 at 11:45

15

Solved

Here is how I query my database for some words $query = $qb->select('w') ->from('DbEntities\Entity\Word', 'w') ->where('w.indictionary = 0 AND w.frequency > 3') ->orderBy('w.freq...
Chemulpo asked 25/5, 2012 at 23:51

3

Solved

How is the IFNULL of SQL implemented in Symfony2 Doctrine Query Builder? Let's say I have this query: select * from ticket order by IFNULL(modified_date, '2000-01-01') DESC, created_date DESC I ...
Attorney asked 1/2, 2012 at 16:27

3

Solved

I am trying to delete only x objects with a delete query from Doctrine. And since there is no LIMIT in doctrine, we should use $query->setMaxResults($limit) instead. I am using Symfony2. However i...
Overcautious asked 14/8, 2014 at 12:32

4

Solved

I have an entity that looks like this: /** * @Gedmo\Tree(type="nested") * @ORM\Table(name="categories") * @ORM\Entity() */ class Category extends BaseCategory { /** * @ORM\OneToMany(targetE...
Amargo asked 8/1, 2013 at 13:54

3

Solved

I need a simple column for a table. By example a table "project", with column id, name and year. If I do: $q = Doctrine_Query::create() ->select('a.pro_id') ->from('fndr_proyecto a') -&...
Lend asked 19/1, 2013 at 4:55

6

Solved

I was used discriminator column in where clause like this: //f = root entity $qb = $this->createQueryBuilder('f'); $qb->add('where', 'f.format = \'image\' OR f.format = \'text\''); I've go...
Eventual asked 13/5, 2011 at 7:27

9

Solved

I am having a table in which there is a column in which various values are stored.i want to retrieve unique values from that table using dql. Doctrine_Query::create() ->select('rec.school') ...
Gaulish asked 27/1, 2010 at 16:37

2

Solved

I have two entities User and Article with many-to-many relation as Article can have many authors. class User { /** @var string */ public $name; /** @var Collection<Article> */ public $a...
Boethius asked 28/3, 2017 at 15:40

2

Solved

I have problem with deleting all rows in database. I can't find out how to do it. I'm using Symfony and Doctrine. Somewhere I read, that it isn't possible "normal" way, but I can do it by...
Sulfide asked 2/9, 2018 at 20:2

2

Solved

$ php app/console doctrine:query:dql 'SELECT NOW()' [Doctrine\ORM\Query\QueryException] [Syntax Error] line 0, col 7: Error: Expected known function, got 'now' How can I use MySQL's NOW() f...
Feingold asked 1/12, 2011 at 20:32

3

Solved

I'm using Symfony 2 with Doctrine, and I've got two entities joined in a many to many association. Let's say I have two entities: User and Group, and the related tables on db are users, groups and ...
Avenge asked 16/4, 2012 at 14:9

4

In my repository I have this query: $qb = $this->getEntityManager()->createQueryBuilder(); $qb ->update('MyBundle:Entity1', 'e1') ->join('e1.Entity2', 'e2') ->set('e1.visibile',...
Catabolite asked 8/3, 2013 at 11:58

5

In my Repository class I use the following code to query: $query = $this->getEntityManager()->createQuery(" SELECT s.term, COUNT(s.term) AS freq FROM App\Entities\SearchTerm s GROUP BY s....
Limann asked 22/12, 2012 at 12:37

3

I need some help when select only discriminator column from doctrine 2 when run the DQL below SELECT p.type FROM AppBundle\Entity\Product p type is discriminator column in entity AppBundle\Entit...
Damick asked 27/10, 2015 at 4:55

3

Solved

Ads entity is described by geographic information: Country> Region>County. The Ads entity is only linked with County. Consequently, retrieving Ads by countries will require us joining entitie...
Processional asked 9/3, 2015 at 8:21

7

Solved

I am trying to get Doctrine2 Entities, ordered by their ID which apparently is a String even though it contains only Numbers. So what I would like to do is something like this: SELECT entity1, cas...
Camenae asked 13/9, 2011 at 16:35

7

Solved

I'm using the PHP Doctrine ORM to build my queries. However, I can't quite seem to figure how to write the following WHERE clause using DQL (Doctrine Query Language): WHERE name='ABC' AND (categor...
Hindoo asked 26/6, 2009 at 15:4

5

Solved

I'm looking to execute the following query: $qb = $this->getEntityManager()->createQueryBuilder(); $qb->select( 'e' ) ->from( 'Entity\Event', 'e' ) ->setMaxResults( $limit ) -...
Immediate asked 10/4, 2014 at 19:17

3

Solved

I'm trying to create a todo list kind of app. At the moment I am just trying to output all the tasks based on the user instanced user id. I'm having some trouble writing the query using $user->g...
Disjunct asked 2/4, 2015 at 9:43

5

If I'm using querying without queryBuilder with this dql $query = $this->_em ->createQuery("SELECT p, g, c FROM LikeYeah\GoBundle\Entity\Product p JOIN p.garments g LEFT JOIN g.colours c...
Menjivar asked 4/2, 2012 at 19:47

2

Solved

I have in my table "Artiste" one column "valideAdmin" who takes value 1 or 0. I try to make a simple count to return the number of entries in my table where "valideAdmin" is to 1: $repo = $this ...
Zins asked 31/5, 2014 at 15:10

4

Solved

I'm trying to personalize a symfony 2.4 repository query to retrieve only some fields. Everything is ok with flat fields but when retrieving Entity fields, I only get the id (by default) but not th...
Cooney asked 31/5, 2018 at 10:5

© 2022 - 2024 — McMap. All rights reserved.