コード例 #1
0
 public static function selectDistinct(...$expressions)
 {
     $select = new SelectClause();
     $select->setDistinct(true);
     $select->addFields($expressions);
     $statement = static::_getQueryStatement();
     $statement->addClause($select);
     return $statement;
 }
コード例 #2
0
ファイル: QlDaoCollection.php プロジェクト: packaged/dal
 /**
  * Find all distinct values of a property in the collection
  *
  * @param $property
  *
  * @return array
  */
 public function distinct($property)
 {
     if ($this->isEmpty()) {
         $select = new SelectClause();
         $select->setDistinct(true);
         $select->addField($property);
         $originalClause = $this->_query->getClause('SELECT');
         $this->_query->addClause($select);
         $results = $this->_getDataStore()->getData($this->_query);
         $this->_query->addClause($originalClause);
         if (empty($results)) {
             return [];
         }
         return Arrays::ipull($results, $property);
     }
     return parent::distinct($property);
 }