[TYPO3-mvc] Respect storage page ignored on object properties

Jochen Rau jochen.rau at typoplanet.de
Sat May 29 09:57:37 CEST 2010


Hi Thomas.

On 28.05.10 10:01, Thomas "Thasmo" Deinhamer wrote:
> Cancel that - your patch works. I'm not sure why, and how this magic
> changes the resultset, but it actually works and only returns
> property-objects whichare stored on the configured storage pages.
>
> Thanks a lot!
>
> This works as long as you a) apply the patch of Jochen and b) use
> setRespectStoragePage(TRUE) in the DataMapper in the method
> getPreparedQuery().
>
> Imho this is a good patch and should be commited to trunk.
>
> Thanks a lot for the help!
> (In the the end you changed 1 line, more [or less] - and I tried for
> hours - that's just insane!! xD)

Thanks for testing the patch. It will go into 1.2.0beta3.

Unfortunately, the patch will not solve your problem, because I do not 
intent to delete the line

$query->getQuerySettings()->setRespectStoragePage(FALSE);

as the behavior you encountered is not a bug.

You have Categories holding the assigned Products. Now, with the PID 
constraint you aim to "filter" only those Products that are available in 
a certain context (a branch of your page tree). But this moves domain 
logic outside of your domain model. I'd call this an intended side 
effect ;-)

Whether product is assigned to a category or not should be explicitly 
defined through your model. I propose to do it the other way around: the 
Product holds references to the Categories it is assigned to. You could 
query for Products that are assigned to a specific Category by saying:

$query->matching($query->contains('categories', $myCategory));

I hope that clarified the PID topic a little bit. We should definitely 
address this topic in the documentation.

Regards
Jochen


More information about the TYPO3-project-typo3v4mvc mailing list