Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $qomFactory = $this->persistenceManager->getBackend()->getQOMFactory();
- $source['client'] = $qomFactory->selector ( 'Tx_Hfcrm_Domain_Model_Client', 'tx_hfcrm_domain_model_client' );
- $source['project'] = $qomFactory->selector ( 'Tx_Hfcrm_Domain_Model_Project', 'tx_hfcrm_domain_model_project' );
- $join = New Tx_Extbase_Persistence_QOM_Join(
- $source['client'],
- $source['project'],
- Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface::JCR_JOIN_TYPE_RIGHT_OUTER,
- $qomFactory->equiJoinCondition (
- 'tx_hfcrm_domain_model_client', 'uid',
- 'tx_hfcrm_domain_model_project', 'client'
- )
- );
- $query = $this->createQuery();
- foreach( $filter->getFilter() as $attribute => $value ) {
- switch( $attribute ) {
- // ...
- case 'projectManager':
- $query->setSource( $source['project'] );
- $constraint['client'] = $query->equals( 'projectManager', $value );
- break;
- case 'clientName':
- $query->setSource( $source['client'] );
- $constraint['clientName'] = $query->like( 'name', '%'.$value.'%' );
- break;
- }
- }
- // set join as actual source
- $query->setSource( $join );
- if ( $constraint ) { $query->matching( $constraint ); }
- return $query->execute();
Advertisement
Add Comment
Please, Sign In to add comment