Hi all.
I was doing a simple query on a TV radio value that had a default value.
All the resources who didn't have the default value showed up fine in the results, but it seems that resources with default value aren't stored at all in the database.
Doing this would give me 0 results as there are no actual entries in the DB:
$c = $modx->newQuery('modResource');
$c->innerJoin('modTemplateVarResource','TemplateVarResources');
$c->where(array('parent' => $parent,
'published' => $getPublished,
'deleted' => 0),
'TemplateVarResources.tmplvarid' => 21,
'TemplateVarResources.value' => $TV_VALUE;
If i tried the version below, it still wouldn't give me any results because those rows that i want don't even have a blank value in the db, it seems the tmplvar row for the resource is deleted if default value.
$c = $modx->newQuery('modResource');
$c->innerJoin('modTemplateVarResource','TemplateVarResources');
$c->where(array('parent' => $parent,
'published' => $getPublished,
'deleted' => 0),
'TemplateVarResources.tmplvarid' => 21,
'TemplateVarResources.value:!=' => $THE_TV_VALUE_I_DONT_WANT;
I ended up working around this by pulling all resources and filtering out those with the tv_value i don't want..
Does anyone have a better solution to this, or have i misunderstood something?
Best regards,
Kristian