dql Questions
1
Solved
So I have this table:
mysql> DESCRIBE table;
+-------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------------+----...
2
Solved
I am to delete a row based on ID, and i used this query to do the task:
$em = $this->getDoctrine()->getManager();
$query = $em->createQuery('DELETE buss from StreetBumbApiBundle:BussOwn...
Pituri asked 2/7, 2015 at 6:22
2
im having troubles with checking boolean field with "is not true" clause
im getting this error:
("[Syntax Error] line 0, col 510: Error: Expected =, <, <=, <>, >, >=, !=, got 'IS'")
q...
Connivance asked 11/6, 2015 at 8:22
2
Solved
Given this entity
class SystemRecord
{
/**
* @ORM\Id
* @ORM\Column(type="integer", name="ID")
* @ORM\GeneratedValue
* @var int
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="Applicat...
Jingoism asked 4/5, 2015 at 19:0
2
Solved
I'm trying to order the results of my query by whether or not they match my original entity on a property. I could do this easily in mySQL with the following query:
SELECT * FROM table
ORDER BY pr...
Monetta asked 6/3, 2013 at 20:40
2
Solved
I use Symfony 2 and Doctrine. In my database MySQL, I have a field of type DateTime. In my Repository file, by using QueryBuilder, I would like to search in this table only by date (without time) a...
Pourparler asked 17/6, 2013 at 17:21
2
Solved
I have two entities
Article
User
Article has a relation to user named 'likedByUsers'
Now, I would like to get the articles order by number of likes, but:
I don't want to have a property 'nu...
Ambitious asked 8/4, 2015 at 10:25
5
Solved
I have a problem with a DQL query and entity specialization.
I have an Entity called Auction, which is OneToOne relation with Item. Item is a mappedSuperclass for Film and Book. I need a query th...
Nidus asked 13/12, 2011 at 21:45
2
Solved
I am quite sure that DQL will be the way to go, but I am wondering if Doctrine, i am using Doctrine 2, has someway to return the row count. I won't be using the rows itself, I just want the count.
...
Hymenium asked 21/1, 2011 at 13:51
2
I'm looking for a way to use Doctrine in Symfony 2 to find items using an ordered array of id.
I have a Card entity with id (primary key) and title.
I have a ListCards entity with id (primary key...
1
Solved
I am having a problem with a DQL query to retrieve users and roles from a MySql database. I am using Zend Framework 2 and Doctrine 2.
The query is as follows.
public function getUsers()
{
$build...
Affaire asked 11/2, 2015 at 17:30
1
I have three entities: HandsetSubscription, Handset and Subscription.
The yaml of HandsetSubscription is:
App\SoBundle\Entity\HandsetSubscription:
type: entity
table: handset_subscription
manyTo...
Angora asked 27/11, 2014 at 17:8
1
I created my custom DQL function for Doctrine DQL:
class Translate extends FunctionNode {
public $field;
public function getSql(SqlWalker $sqlWalker) {
$query = "TRANSLATE(" . $this->field-...
Saleswoman asked 27/3, 2013 at 11:41
2
Solved
Situaction: I am trying to select count() in DQL for users NOT in specific group.
Standard ManyToMany unidirectional relation between User and Group entities from FOSUserBundle (and SonataUserBund...
Spotted asked 17/9, 2014 at 9:25
2
I have the following code
$qb = $this->createQueryBuilder('cs')
->update()
->set('cs.is_active', 1)
->where('cs.reward_coupon = :reward_coupon')
->setMaxResults($limit)
->se...
Kelbee asked 1/9, 2014 at 12:59
1
Solved
Assume the following AbstractPage model:
/*
* @ORM\Entity
* @ORM\Table(name="page")
* @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(name="type", type="string")
* @ORM\Discri...
Purposive asked 5/12, 2013 at 9:45
1
Solved
DQL below generates an error:[Syntax Error] line 0, col 42: Error: Expected known function, got 'sha1'
Any way of using SHA1?
public function findIdByDql($hashId)
{
$em = $this->getEntityMana...
Skilling asked 2/8, 2014 at 22:25
1
Solved
I'm trying to use a subquery in a IN statement in Doctrine2.
Here's what the raw SQL query should look like :
SELECT * FROM license
WHERE id
IN (SELECT id
FROM license
WHERE subscription = ...
Acyclic asked 9/1, 2013 at 11:28
2
Solved
I'm trying to create a query for retrieving objects from a Doctrine database, sorted by the number of members of a specific one-to-many relationship.
More specifically: I have two Entities: Person...
Friesian asked 28/9, 2012 at 19:4
1
Solved
I have a DQL as like below:
SELECT at, count(at.id) FROM AccountTriple at JOIN at.property p JOIN at.account ac WHERE p.create_analytics = '1' GROUP BY at.property, at.value, ac.service
As you c...
Vesiculate asked 6/7, 2014 at 21:23
2
Solved
I have this Query in native MySQL Code
SELECT *
FROM `turn`
LEFT JOIN (
poi
) ON ( turn.id = poi.turn_id )
GROUP BY turn.id
ORDER BY count( case when poi.image = 1 then 1 else null end) DESC;
I...
Participate asked 4/7, 2014 at 7:30
1
Solved
I have this entity:
/**
* User state.
*
* @ORM\Entity(repositoryClass="User\Repository\StateRepository")
* @ORM\Table(name="user_state")
*/
class State implements StateInterface
{
/** ONE-TO...
Bascomb asked 15/5, 2014 at 11:57
3
Solved
I have a problem while trying to USE QueryBuilder OR DQL.
I have the following relation:
User <-1:n-> Profile <-n:m-> RouteGroup <-1:n-> Route
I would like to make a DQL that lists all...
Falsework asked 13/11, 2012 at 1:33
1
Solved
I'm trying to use external params in a DQL-s SELECT part, but it doesn't work due to an error.
What I'm trying:
$query = $this->getEntityManager()
->createQuery("
SELECT me.column_one, :p...
Danger asked 26/2, 2014 at 13:11
3
Solved
I have written a DQL query in Doctrine 2:
$qb->select('r.position')
->from('\Entities\Races', 'r')
->where($qb->expr()->eq('r.entrantId', ':entrant_id'))
->setParameter('entra...
Hanfurd asked 15/8, 2011 at 10:29
© 2022 - 2024 — McMap. All rights reserved.