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...
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 ...
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')
...
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
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 ...
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...
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...
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 ...
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...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.