Snippets

This Mächler TYPO3 - Extbase Repository - find by PID and limit

Created by This Mächler
/**
 * Get all not-succseeded Anmeldungen that have data stored
 *
 * @param string $pidList (comma separated list)
 * @param int $limit
 * @return \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult
 */
public function findFailedAnmeldungen($pidList = '', $limit = 0){
  $q = $this->createQuery();
  $andConstraints = array(
    $q->equals('tx_mediescada_anmeldung_success',0),
    $q->logicalNot(
      $q->equals('tx_mediescada_anmeldung_datafactory', '')
    )
  );
  if($pidList){
    $pidListArr = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $pidList, 1);
    if( count($pidListArr) ){
      $andConstraints[] = $q->in('pid', $pidListArr);
    }
  }
  $q->matching( $q->logicalAnd( $andConstraints ) );
  if($limit){
    $q->setLimit($limit);
  }
  return $q->execute();
}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.