Imagine, i have 2 template variables: color and price.
Now imagine i want to build a query...that does the following:
"Fetch all resource ID’s that have color red and price below 10".
This is a problem since template variables do not have actual column
names. I’ve been breaking my head over this...this is what i have:
$query = $modx->newQuery('modTemplateVarResource');
$query->where(array(
array('tmplvarid' => 1,
'value' => 'Red',
array('AND:tmplvarid:=' => 2,
'AND:value:<' => 10)
)
));
But as you can see, this is a huge problem because no row will have
tmplvarid 1 AND 2...Will i have to execute multiple queries for this?
Or am i missing something...
Thanks in advance.
[edit]
I have something working here...but still the question remains: "Is this the way to do it in XPDO?"
$query = $modx->newQuery('modTemplateVarResource');
$query->innerJoin('modTemplateVarResource', 'tplVar', 'modTemplateVarResource.contentid = tplVar.contentid');
$query->where(array(
'modTemplateVarResource.tmplvarid' => 5,
'modTemplateVarResource.value' => 'rood',
'tplVar.tmplvarid' => 7,
'tplVar.value' => 'aardbei'
));
It takes quite some time (1,8 seconds) for 3,5 million rows.

[/edit]