Exemple #1
0
 /**
  * Returns the users which are in the groups with the given UIDs.
  *
  * @param string $groupUids
  *        the UIDs of the user groups from which to get the users, must be a
  *        comma-separated list of group UIDs, must not be empty
  *
  * @return Tx_Oelib_List<Tx_Oelib_Model_FrontEndUser> the found user models, will be empty if
  *                       no users were found for the given groups
  */
 public function getGroupMembers($groupUids)
 {
     if ($groupUids === '') {
         throw new InvalidArgumentException('$groupUids must not be an empty string.', 1331488505);
     }
     return $this->getListOfModels(Tx_Oelib_Db::selectMultiple('*', $this->getTableName(), $this->getUniversalWhereClause() . ' AND ' . 'usergroup REGEXP \'(^|,)(' . implode('|', t3lib_div::intExplode(',', $groupUids)) . ')($|,)\''));
 }
Exemple #2
0
 /**
  * Retrieves all non-deleted, non-hidden models from the DB which match the
  * given where clause.
  *
  * @param string $whereClause
  *        WHERE clause for the record to retrieve must be quoted and SQL
  *        safe, may be empty
  * @param string $sorting
  *        the sorting for the found records, must be a valid DB field
  *        optionally followed by "ASC" or "DESC", may be empty
  * @param string $limit the LIMIT value ([begin,]max), may be empty
  *
  * @return Tx_Oelib_List<Tx_Oelib_Model> all models found in DB for the given where clause,
  *                       will be an empty list if no models were found
  */
 protected function findByWhereClause($whereClause = '', $sorting = '', $limit = '')
 {
     $orderBy = '';
     $tca = Tx_Oelib_Db::getTcaForTable($this->getTableName());
     if ($sorting !== '') {
         $orderBy = $sorting;
     } elseif (isset($tca['ctrl']['default_sortby'])) {
         $matches = array();
         if (preg_match('/^ORDER BY (.+)$/', $tca['ctrl']['default_sortby'], $matches)) {
             $orderBy = $matches[1];
         }
     }
     $completeWhereClause = $whereClause === '' ? '' : $whereClause . ' AND ';
     $rows = Tx_Oelib_Db::selectMultiple('*', $this->getTableName(), $completeWhereClause . $this->getUniversalWhereClause(), '', $orderBy, $limit);
     return $this->getListOfModels($rows);
 }
Exemple #3
0
 /**
  * @test
  */
 public function selectMultipleCanFindTwoRows()
 {
     $this->testingFramework->createRecord('tx_oelib_test', array('title' => 'foo'));
     $this->testingFramework->createRecord('tx_oelib_test', array('title' => 'foo'));
     self::assertSame(array(array('title' => 'foo'), array('title' => 'foo')), Tx_Oelib_Db::selectMultiple('title', 'tx_oelib_test', 'title = "foo"'));
 }