[TYPO3-mvc] Complex query just not working

Thomas "Thasmo" Deinhamer thasmo at gmail.com
Wed Jul 13 01:03:45 CEST 2011


Franz Koch schrieb:
> I'm sorry, but the nesting of your statements looks wired. I stripped it
> down to what would make sense to me if I got you right, but I'm not sure
> if the "->in()" constraints will work correctly for the categories (in
> doubt do as you did before). Also I'm half asleep - so it might be
> totally nonsense ;)
>
> http://pastebin.com/dxepmqeQ

Hey, thanks for your reply!

Actually this is very weird.

This case works (only include* fields used):
$constraint = $query->logicalOr(
	$query->in('includedCategories.uid', $categories),
	$query->contains('includedProducts', $product)
);

But when I'm adding the "AND NOT" part, the query doesn't
find any discounts, although the 'exclude*' fields are
empty in all stored discounts. That's pretty weird.

This case does not work (include and exclude fields used):
$constraint = $query->logicalAnd(
	$query->logicalOr(
		$query->in('includedCategories.uid', $categories),
		$query->contains('includedProducts', $product)
	),
	$query->logicalNot(
		$query->logicalOr(
			$query->in('excludedCategories.uid', $categories),
			$query->contains('excludedProducts', $product)
		)
	)
);

Is this weird? Any ideas?

Regards,
Thomas


More information about the TYPO3-project-typo3v4mvc mailing list