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 and things as appropriate, like this
$q->where('normalisedname = ? OR name = ?', array($string, $originalString));
Later on, before execute()-in...
I'm using Doctrine, a PHP ORM. I have created a Doctrine Query, and I need more control. So I've started to use the ->andWhere(...) methods to add new where clauses. However I need to do a subquery based on another table, like so:
$query->andWhere("id in (SELECT id from other_table where value = ?)", $myvar);
The above doesn't work. H...
I used this DQL in Doctrine
$q->update('product')
->set('quantity','?')
->where('id=?');
$q->execute(array(20,5));
I check the server for the query and this the generated sql
UPDATE product SET quantity = '20', updated_at = '5'
WHERE (id = '2010-04-26 14:34);
So I need to know why the arguments aren't in the correct places?
...
Symfony 1.4 + Doctrine 1.2.
What is the best way to minimize the number of queries to retrieve products, subcategories of current category, product counts by subcategory and brand for the result set of the query below? Categories are a nested set.
Here is my query:
$q = Doctrine_Query::create()
->select('c.*, p.product,p.pri...
I have three tables:
Project:
...
relations:
User:
local: authorId
foreign: id
Users:
class: User
local: projectId
foreign: userId
refClass: UserProjects
User:
...
relations:
Projects:
class: Project
local: userId
foreign: projectId
refClass: UserProjects
...
I searched for a long time, but I don't manage to retrieve two related object in one query. I am using Doctrine and Symfony (uses Doctrine by default).
Here is a part of my schema.yml:
Member:
columns:
...some fields...
Report:
columns:
member: { type: integer, notnull: true }
...some fields...
relations:
M...
Doctrine always includes an ID column in a query, for example:
$new_fees = Doctrine::getTable('Stats')->createQuery('s')
->select('s.sid')->where('s.uid = ?', $this->uid)
->andWhere('s.operation = ?', PPOperationType::FEE_PAID_BY_REFERRED_OWNER)
->andWhere('s.created_at > ?', $lastwd)
->groupBy('s.sid')->execute();
won't work...
I'm having trouble executing a Doctrine DQL Query. This is the error it gives me.
Doctrine\Common\Annotations\AnnotationException: [Syntax Error] Expected PlainValue,
got 'integer' at position 13 in property Base\Session::$lifetime.
My code looks like this:
$query = $em->createQuery("SELECT s FROM Base\Session s WHERE s.session = \"...
I know this has to have an easy answer, but I cannot figure it out. After tears, I am hoping someone here can help.
Here is my YML model:
Identity:
columns:
id:
type: integer(10)
primary: true
autoincrement: true
username:
type: string(255)
Profile:
columns:
id:
...
Hello,
I have an action with two requests on an unique table. The results of the requests must be different.
But, the result is the same for my two requests and it comes from my second request.
// Récupération du (ou des) locataire(s) actuel(s) du logement
$this->locataires = Doctrine_Query::create()
->from('logement l')...
I'm using a preDqlSelect() callback to add a "virtual field". But the validation of my query must be happening before the callback get fired because I can't order by that new field when I query that model.
Here's my callback:
class Artist extends BaseArtist
{
public function preDqlSelect(Doctrine_Event $event)
{
// Ad...
Product has many product images.
I want to grab a bunch of products, while only getting one product image each. What's the DQL syntax for that?
I'm using Doctrine 1.2.
...