dql Questions
3
Solved
I build a form with entity type like this:
$form = $this->createFormBuilder()
->add('users', 'entity', array(
'class' => 'UserBundle:Users',
'query_builder' => function(EntityReposit...
3
How should I go about ordering by a discriminator column in a doctrine repository query?
I have a pretty straight forward setup,
I have different types of payment details,
it can either be Credi...
Gravimeter asked 16/10, 2013 at 14:17
1
Solved
I'm trying to figure out how, in a symfony 3.4 app, to retrieve (through a repository method, with a DQL request for example) entities depending on a value for a specific key in a "json" typed colu...
2
Solved
I am using Doctrine 1.1 in Zend. I am trying to write a query that will return records that have a null value in a certain column.
$q = Doctrine_Query::create()
->select('a.*')
->from('Ru...
5
Solved
I need to construct DQL with a QueryBuilder like this
[QUERY]... AND WHERE e.type = x OR e.type = Y OR e.type = N [...]
I have types in array How can I pass this array to my query builder?
$q...
Waldon asked 28/7, 2012 at 20:34
2
Solved
I want to use the parameter place holder - e.g. ?1 - with the % wild cards. that is, something like: "u.name LIKE %?1%" (though this throws an error). The docs have the following two examples:
1.
...
Angadresma asked 20/9, 2010 at 21:38
1
Using dql I tried to check if a entity is member of a collections subentity
entites:
product
customer
customer.orders (collection)
customer.orders.products (collection, type: product)
custo...
Paniagua asked 17/7, 2013 at 10:1
2
Solved
I losted trilion hours google this but none of the solutions were good.
I have this querybuilder:
$qb2=$this->createQueryBuilder('s')
->addSelect('u')
->innerJoin('s.user','u')
->...
Dermatome asked 27/4, 2013 at 17:38
6
Solved
I'm probably overlooking something very simple and just been staring at it too much, but I can't get this DQL query to work. I get an exception stating:
Cannot select entity through identification...
Sarajane asked 18/4, 2012 at 7:17
5
Solved
This should be simple but I can't find a working example. Here's a controller method that throws the error "Invalid parameter number: number of bound variables does not match number of tokens". I'm...
Biota asked 11/9, 2011 at 16:41
2
Solved
When performing a DQL query such as:
SELECT u AS user, t AS transaction
FROM Model\User u
JOIN Model\Transaction t WITH t.user = u
You get alternating rows of results, such as:
['user' => M...
Dinny asked 31/5, 2016 at 12:37
2
Solved
Since other (old) questions didn't get proper answers, I'll try it again:
I regularly come across a scenario, where I want to query an entity with a specific value:
$query = $em->createQuery('...
Yoshieyoshiko asked 9/2, 2015 at 8:50
3
I regularly come across a scenario, where I want to query an entity with a specific value:
$query = $em->createQuery('SELECT e FROM Entity e WHERE e.parent = :parent');
$query->setParamete...
Georgetown asked 2/1, 2013 at 13:27
4
Solved
I have two classes in this example - DeliveryMethod and Country. They have a many-to-many relationship with each other.
What I want to do is select all DeliveryMethods that do not have any Countri...
3
I have a Doctrine model (Assignment), which has a many-to-one relationship with another model (Region). Assignments are owned by users (with each user having only one assignment per region at a tim...
Armada asked 4/9, 2012 at 17:59
1
Solved
How do I create an efficient DQL statement, to match my efficient SQL when doing a simple LEFT JOIN?
I can craft a simple SQL that returns 1 when there is an item with requested id and corresponding model that matches FS-%, and 0 otherwise.
But when I try to write it as DQL, I fail in all spectac...
Candless asked 6/6, 2016 at 23:10
2
Solved
Using Symfony and Doctrine with the DQL query builder, I need to optionally add some WHERE conditions with parameters, with some if condition checks.
Pseudo code example:
$qb = $this->getEntit...
Expunge asked 19/5, 2016 at 14:41
6
Solved
I'm building an app using Symfony2 framework and using Doctrine ORM. I have a table with airlines for which some IATA codes are missing. I'm outputting a list, ordered by this IATA code, but I'm ge...
Lodging asked 29/9, 2012 at 10:43
2
Solved
i have entities **target,citytarget,city,cityplace,place
citytarget & cityplace are pivot tables that connect t&c and c&p
i need the places for given city name and a target id
i trie...
2
I'm porting simple web application written in CodeIgniter to Symfony2 bundle. I'm new into Symfony2 and Doctrine and I've a problem with one SQL query, that I want to rewrite in DQL. I've all ready...
Boatswain asked 3/2, 2012 at 9:50
3
Solved
I have one document in my "params" collection like this:
{
"_id": ObjectId("4d124cef3ffcf6f410000037"),
"code": "color",
"productTypes": [
{
"$ref": "productTypes",
"$id": ObjectId("4d120a2d...
1
Solved
I'm trying to do:
class PrixRepository extends EntityRepository
{
public function findPrixLike($film)
{
$query = $this->createQueryBuilder('p')
->addSelect('s')
->from('MG\UserBundle...
Neotropical asked 15/9, 2015 at 12:11
1
Solved
Trying to conver my sql queries into dql, seems im doing something wrong.
I need basic joins, something like this.
SELECT a.id, a.title, u.name FROM articles JOIN users ON a.author_id = u.id
Tr...
2
Solved
According to DDC-2204 issue which states
[Order by With Equals] is supported by including the condition in the SELECT clause, aliasing it, then using it. You might need to use "AS HIDDEN name" t...
Lavin asked 10/9, 2014 at 9:35
2
Solved
I'm following the security chapter of the Symfony 2 book.
There's is an example with a table USERS and GROUPS. There is a many-to-many relationship between USERS and GROUPS, which creates in the d...
Golub asked 11/3, 2012 at 8:22
© 2022 - 2024 — McMap. All rights reserved.