[TYPO3-mvc] RELATION_HAS_ONE and OPERATOR_NOT_EQUAL_TO

Franz Koch typo3.RemoveForMessage at elements-net.de
Mon Jul 12 02:32:23 CEST 2010


On 11.07.2010 19:21, Cornelius Illi wrote:
> Hi everyone,
>
> does anybody know a source, where to find something about different
> types of relations N:M, 1:M and especially 1:1?
> There is an example for a 1:M in the extension "blog_examples" for
> author's of posts and comments (as announced here:
> http://lists.typo3.org/pipermail/typo3-project-typo3v4mvc/2009-July/000586.html)
>
> However, the Query used an IN-Statement so that a comma-seperated list
> would also be accepted, which would allow a N:M-Relation aswell.
> It works, just wanna know the concept behind it.

Not sure what you want? Are you looking for a way to query 1:1 relations?

return $query->matching ( 
$query->equals('1to1relationProperty',$objectToMatch) )->execute();


> Also i was in need of using a Comparison with OPERATOR_NOT_EQUAL_TO as
> an operator. Unfortunately there is not method like $query->nequals(),
> so I used something like this:
>
> t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_Comparison',
> t3lib_div::makeInstance('Tx_Extbase_Persistence_QOM_PropertyValue',
> 'additionaldata.description', ''),
> Tx_Extbase_Persistence_QueryInterface::OPERATOR_NOT_EQUAL_TO, '');
>
> Any better solution to do so?

$query = $this->createQuery();
$query->matching(
		$query->logicalNot( $query->equals('additionaldata.description', '') )
	)->execute();

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list