Questions tagged [doctrine-query]

Doctrine Query Language (DQL) is one of the Doctrine 2 ORM key features, it is the option to write database queries in a proprietary object oriented SQL dialect.

Doctrine Query Language (DQL) is one of the Doctrine 2 ORM key features, it is the option to write database queries in a proprietary object oriented SQL dialect. Inspired by Hibernates HQL, this provides developers with a powerful alternative to SQL that maintains flexibility without requiring unnecessary code duplication.

More about Doctrine ORM you could fine on the project site, here.

370 questions
0
votes
1 answer

Strange behaviour with Doctrine_Query in Doctrine 1.2

I have a query that has multiple orWhere statements. The PHP code looks like this: $firstDay = $params['datetimeForMonth']->format('Y-m-d'); $lastDay = $params['datetimeForMonth']->format('Y-m-t 23:59:59'); $whereStatement = "(s.level = ? AND…
blainarmstrong
  • 1,040
  • 1
  • 13
  • 33
0
votes
1 answer

Syntax error with execute a query with one to one

I have two entities: User entity with two fields are: id (@id), username Profile entity with two fields are: user(@OneToOne,targetEntity="User"), fullname But when I make a query try from things I read an JPA book: SELECT p from Profile p where…
vietean
  • 2,975
  • 9
  • 40
  • 65
0
votes
1 answer

How to write this doctrine query with multiple joins?

I have an entity Person (p) which is related to an entity Notifications related to an entity NotificationType. Some persons have received a notification of type 1 (notification_type_id = 1). Some have received notifications but not of the type…
Reveclair
  • 2,399
  • 7
  • 37
  • 59
0
votes
1 answer

Doctrine ODM: Cannot prime->(true) getSingleResult(); throws cursor error

I have a document that has a ReferenceMany attribute to another document. The reference is setup fine, and the data is returned from the query fine, but each document in the arraycollection is returned as a proxy. On this site, I saw it was…
Nathan
  • 2,941
  • 6
  • 49
  • 80
0
votes
1 answer

Return all rows where the entire list of a relation matches (as opposed to any combination of)

With the following simple table structure: Data ---------- id Tag ---------- id TaggedData ---------- id tag_id data_id If I had a list of Tag ids, how would I fetch every row of Data where every row of Tag in my list has a relation to a row of…
Alexander Trauzzi
  • 7,277
  • 13
  • 68
  • 112
0
votes
2 answers

doctrine2: different way of querying, different results

Can someone explain, why I get different results? $user = new UserEn(); $user->setName("test"); $em->persist($user); $result1 = $em->find('UserEn', 'test'); $result2 = $em->getRepository('UserEn')->findBy(array('name'=>'test')); $q =…
user1592714
  • 443
  • 4
  • 11
0
votes
1 answer

Doctrine2: entity visibility in multi processes

Here is an example.php on the Web: ... $page = new SomeEntity(); $page->setName("xx"); // name is primary key $em->persist($page); .... Question: what would happen, when example2.php asks: $result = $em->find('SomeEntity', 'xx'); ? null or object…
user1592714
  • 443
  • 4
  • 11
0
votes
1 answer

Doctrine2 Product and Features Mapping Problems

I am making an E-commerce solution that needs to be a multi-store solution. I am seriously stuck while making the Associations between Products and it's features. As it is a multi-store solution I need dynamic feature possibilities per product. I…
Aayush
  • 3,079
  • 10
  • 49
  • 71
0
votes
1 answer

How to get specific column that is duplicated in Doctrine ORM?

how can I get specific column with duplicated name via Doctrine ORM? I'm working on a project using custom engine that is made in Zend. The problem is I got duplicated column names in 2 tables (c_naslovi and c_sportovi) Can I do column rename maybe?…
Tom
  • 679
  • 1
  • 12
  • 29
0
votes
1 answer

How to get a doctrine loop to find the number of grouped records

I am working on a query that is returning all published records, and grouping and ordering them by the latest updated_version. Then I am filtering that result to show the results that were updated in the last 24 hrs, week, and month. All works…
Carey Estes
  • 1,534
  • 2
  • 31
  • 59
0
votes
1 answer

orderBy & groupBy query

My db entries id | shop_id | last_changed 1 | 1 | 7 pm 2 | 1 | 8 pm 3 | 2 | 9 pm 4 | 2 | 8 pm 5 | 3 | 5 pm My query should be that I only get entries with the id: 2, 3, 5 When I do this: $q =…
craphunter
  • 820
  • 2
  • 15
  • 27
0
votes
1 answer

Zend Doctrine query innerjoin

Great site this is! A lot of good programmers. But I can't even get a simple doctrine join to work: $query = Doctrine_Query::create() ->from("StaffIndividualHasAddressAddress sa") ->innerJoin("sa.AddressAddress aa"); Always bums out…
jasper
  • 3
  • 4
0
votes
2 answers

No description for object of class "stuff" in symfony

I'm trying to execute this: $q = Doctrine_Query::create() ->select('MAX(s.ID) AS max') ->from('stuff s') ->execute(); I'm getting: No description for object of class "stuff". What am I doing wrong?
Academia
  • 3,984
  • 6
  • 32
  • 49
-1
votes
1 answer

Doctrine querybuilder not working for my SQL statement in PHP

Please forgive me, I am fairly new to programming. Basically, I am trying to run a SQL statement without making it susceptible to SQL Injections I tried running my code but it is having issues here: $manager =…
-1
votes
1 answer

Apply multiples conditions with Doctrine Query Language

In my database, i have a column "refused", she can have 0 or 1 or NULL value. I want to get only rows with 0 and NULL values. I tried this : ->andWhere('b.refused IS NULL') It's okay, but if i want to get the 0 values too that's not working…
Tony S
  • 491
  • 6
  • 26
1 2 3
24
25