doctrine-query Questions

21

Solved

We're using Doctrine, a PHP ORM. I am creating a query like this: $q = Doctrine_Query::create()->select('id')->from('MyTable'); and then in the function I'm adding in various where clauses...
Lauer asked 19/1, 2010 at 17:15

6

In order to debug my code I would like to see the explicit sql query that is executed. I create the query with createQueryBuilder, and the most explicit thing I achieved is having the raw query us...
Rancho asked 27/6, 2012 at 12:22

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

3

Solved

Im trying to reproduce this query: SELECT * FROM `request_lines` where request_id not in( select requestLine_id from `asset_request_lines` where asset_id = 1 ) in doctrine query builder, I am s...
Lupita asked 19/12, 2012 at 16:58

5

Solved

I need to fetch all records in database as Array using findAll() in Doctrine, My Query is Something like this $result = $this->getDoctrine() ->getRepository('CoreBundle:Categories') ->f...
Unwholesome asked 20/3, 2017 at 17:51

4

I have a Doctrine fetch statement like this $query = "SELECT id FROM table LIMIT 2"; $result = $db->fetchAll($query); which returns the array like this: Array ( [0] => Array ( [id] =&gt...
Quaggy asked 4/12, 2013 at 13:54

1

Solved

I have found Doctrine\Common\Collections\Criteria to be a very useful concept, if they worked for me. In a symfony controller, I am calling this code: $criteria = Criteria::create() ->where(C...
Dignitary asked 23/3, 2018 at 13:39

4

As per the title, how would one match on a regular expression with the Doctrine 2 query builder? Basically I'm trying to generate unique slugs. Here is my current implementation. I generate the s...
Audrieaudris asked 4/7, 2011 at 18:7

0

I would like to know if it's possible to alias a column name with spaces in for example $query = "SELECT u.firstName AS 'First Name' FROM User u"; $result = $query->getResult( Query::HYDRATE_AR...
Predecease asked 7/1, 2017 at 8:32

3

Solved

I am trying to fetch the total number of rows found for specific query when LIMIT is applied. I successfully found the answer in PHP/MySQL, But I am not able to conver the logic in Zend/Doctrine. I...
Mitten asked 13/6, 2013 at 5:23

1

Solved

I have 3 entities associated this way: Don't worry, I've set associations using annotations, but I thought the following mix would be lighter/cleaner to expose my issue Post @ORM\ManyToOne(targe...
Columbuscolumbyne asked 7/7, 2016 at 17:37

1

Solved

This is my query with query builder, and it works perfectly, bringing all the results of user table and the modules table, which has a many to many association: public function getUser($id){ $qb ...
Concessionaire asked 28/2, 2016 at 16:35

5

Solved

How I can with doctrine2 order by array with ids ? I have this query: $qb = $this->createQueryBuilder('u') ->select('u', 'n', 'c') ->leftJoin('u.notifications', 'n') ->leftJoin('u....
Nilgai asked 23/5, 2014 at 16:41

1

Solved

My target is: Create universal association where first entity (eg. Category) can be used many times for other Objects (eg. Post, Article) Example Post has categories and Article has categories,...
Del asked 6/1, 2016 at 18:57

1

Solved

I'm working on a symfony project entity with query builder. When I try to run this function I get this issue. [Semantical Error] line 0, col 9 near 'category FROM': Error: Invalid PathExpression...
Micropyle asked 22/12, 2015 at 3:40

4

Solved

I am able to fetch my data from database by using this structure: $user = $this->getDoctrine() ->getRepository('AcmeDemoBundle:Emails') ->find(8081); When I do that, I am able to get my d...
Clawson asked 7/5, 2012 at 12:27

2

How to use the expression mysql NOW() in doctrine querybuilder?
Bearable asked 16/12, 2012 at 21:48

1

Solved

Im using the Doctrine Query Builder, and have a very specific requirement that came through. I am using the ManyToMany field in my entity, related to User entity association (Array of User account...

1

Solved

I need to fetch a list of countries, sorted by alphabetical order. Since I have the entity translated in four languages (english, french, spanish and chinese), I've used gedmo doctrine extensions i...
Sciomancy asked 24/9, 2013 at 14:17

2

Solved

I've following database schema - Now department, year and division tables are already filled with information. I now need to insert student data. Student data is to be imported from xls file ...
Hortensehortensia asked 8/12, 2013 at 14:40

1

Solved

I'm currently working on a Service in SF2 that queries the database with the QueryBuilder using a class variable set with a repository-specific QueryBuilder in the constructor of this Service. Whi...
Accelerate asked 12/12, 2013 at 15:43

2

Solved

I want to use union in doctrine, i searched a lot but didn't get any success, this is my union query in sql, how to convert this query in doctrine? select * from (select orderid,tutorialId,points,...
Arabic asked 1/10, 2013 at 9:44

1

Solved

I wish to fetch an entity where the inversed association does not exist (on a 1:1 association) I get the error: A single-valued association path expression to an inverse side is not supported i...
Terminal asked 5/8, 2013 at 12:16

1

Solved

I'm using the following code in the query builder, to select an average of score values, and the category entity to which that average belongs: $queryBuilder = $this->createQueryBuilder('s') -...
Demy asked 26/7, 2013 at 9:52

1

Solved

I am learning from this Question but facing issues with many operations in between: doctrine 2 query builder and join tables Below is my Questions. I am looking for help in my previous question t...
Hypolimnion asked 14/6, 2013 at 18:37

© 2022 - 2024 — McMap. All rights reserved.