Hello,
I have a special case where I need to create a where clause with following conditions:
I have left joined a TV to the modResource table.
The value field of the TV has comma separated ids in it.
And I have an array which also holds a list of ids.
(CategoryTV.value holds comma seperated values and $arrCatIDs holds list of ids)
I'd like to get all rows where 'one or many' ids of the TV are equal to 'one or many' ids from the array.
The IN operator doesn't work here.
Is this a relational division? And if so, how can I solve this with xPDO?
Thanks,
Martin
Can you describe what it is you're trying to get? I can't quite puzzle it out from your description. The IDs in the TV are IDs of what object? And IDs in the array are IDs of what object?
If you just want all Resources with IDs in either array, you shouldn't need a join.
OK - I try to find a better explanation:
I have a resource inside an Articles container - lets say Articles1 - with an attached TV called Categories. This TV contains a comma separated list of category IDs from a custom table.
The same resource has attached another TV called SelectNews (which calls a snippet). This TV should list a group of resources from another Articles container - lets say Articles2 - based on the selection of one or many category IDs from the Categories TV.
The resources from Articles2 also have attached the CategoriesTV and one or many categories can be selected there.
I'd like to get all resources from container Articles2 where 'one or many' category IDs are equal to 'one or many' category ids from the selected ones in the first resource.
I think the confusion is perfect now, but I don't know how to explain this better. Sorry.
I would create a join-table where you have collected all relations between categories and resources.
You can syncronize this table with your TVs by onDocFormSave.
Than its easy to get all Resources, which are at least in one of a given list of resource-ids.
Would also be possible to use a MIGXdb-grid-TV to add/remove category-links