public function find(array $criteria = [], array $options = [], $together = false)
    {
        $result = [];
        $this->joins = [];
        $this->queryParams = [];
        $this->selectColumns = $this->getPrimaryColumns();
        $this->groupColumns = ['t.delivery_execution_id'];
        $defaultOptions = [
            'order' => join(' ', [static::DEFAULT_SORT_COLUMN, static::DEFAULT_SORT_ORDER, static::DEFAULT_SORT_TYPE]),
            'offset' => 0,
            'asArray' => false
        ];
        $options = array_merge($defaultOptions, $options);

        $options['order'] = $this->prepareOrderStmt($options['order']);
        $fromClause = "FROM " . self::TABLE_NAME . " t ";

        $whereClause = $this->prepareCondition($criteria, $this->queryParams, $selectClause);
        if ($whereClause !== '') {
            $whereClause = 'WHERE ' . $whereClause;
        }
        $selectClause = "SELECT " . implode(',', $this->selectColumns);
        $sql = $selectClause . ' ' . $fromClause . PHP_EOL .
            implode(PHP_EOL, $this->joins) . PHP_EOL .
            $whereClause . PHP_EOL .
            'GROUP BY ' . implode(',', $this->groupColumns) . PHP_EOL;

        $sql .= "ORDER BY " . $options['order'];

        if (isset($options['limit']))  {
            $sql = $this->getPersistence()->getPlatForm()->limitStatement($sql, $options['limit'], $options['offset']);
        }

        $stmt = $this->getPersistence()->query($sql, $this->queryParams);

        $data = $stmt->fetchAll(\PDO::FETCH_ASSOC);

        if ($together) {
            $ids = array_column($data, static::COLUMN_ID);
            $kvData = $this->getKvData($ids);
            foreach ($data as &$row) {
                if (isset($kvData[$row[static::COLUMN_ID]])) {
                    $row = array_merge($row, $kvData[$row[static::COLUMN_ID]]);
                }
            }
            unset($row);
        }

        if ($options['asArray']) {
            $result = $data;
        } else {
            foreach($data as $row) {
                $deliveryExecution = ServiceProxy::singleton()->getDeliveryExecution($row[self::COLUMN_DELIVERY_EXECUTION_ID]);
                $result[] = $this->buildData($deliveryExecution, $row);
            }
        }

        return $result;
    }
public function find(array $criteria = [], array $options = [], $together = false)
    {
        $result = [];
        $this->joins = [];
        $this->queryParams = [];
        $this->selectColumns = $this->getPrimaryColumns();
        $this->groupColumns = ['t.delivery_execution_id'];
        $defaultOptions = [
            'order' => join(' ', [static::DEFAULT_SORT_COLUMN, static::DEFAULT_SORT_ORDER, static::DEFAULT_SORT_TYPE]),
            'offset' => 0,
            'asArray' => false
        ];
        $options = array_merge($defaultOptions, $options);

        $options['order'] = $this->prepareOrderStmt($options['order']);
        $fromClause = "FROM " . self::TABLE_NAME . " t ";

        $whereClause = $this->prepareCondition($criteria, $this->queryParams, $selectClause);
        if ($whereClause !== '') {
            $whereClause = 'WHERE ' . $whereClause;
        }
        $selectClause = "SELECT " . implode(',', $this->selectColumns);
        $sql = $selectClause . ' ' . $fromClause . PHP_EOL .
            implode(PHP_EOL, $this->joins) . PHP_EOL .
            $whereClause . PHP_EOL .
            'GROUP BY ' . implode(',', $this->groupColumns) . PHP_EOL;

        $sql .= "ORDER BY " . $options['order'];

        if (isset($options['limit']))  {
            $sql = $this->getPersistence()->getPlatForm()->limitStatement($sql, $options['limit'], $options['offset']);
        }

        $stmt = $this->getPersistence()->query($sql, $this->queryParams);

        $data = $stmt->fetchAll(\PDO::FETCH_ASSOC);

        if ($together) {
            $ids = array_column($data, static::COLUMN_ID);
            $kvData = $this->getKvData($ids);
            foreach ($data as &$row) {
                if (isset($kvData[$row[static::COLUMN_ID]])) {
                    $row = array_merge($row, $kvData[$row[static::COLUMN_ID]]);
                }
            }
            unset($row);
        }

        if ($options['asArray']) {
            $result = $data;
        } else {
            foreach($data as $row) {
                $deliveryExecution = ServiceProxy::singleton()->getDeliveryExecution($row[self::COLUMN_DELIVERY_EXECUTION_ID]);
                $result[] = $this->buildData($deliveryExecution, $row);
            }
        }

        return $result;
    }
public function find ( array $ criteria = [ ] , array $ options = [ ] , $ together = false ) { $ result = [ ] ; $ this -> joins = [ ] ; $ this -> queryParams = [ ] ; $ this -> selectColumns = $ this -> getPrimaryColumns ( ) ; $ this -> groupColumns = [ 't.delivery_execution_id' ] ; $ defaultOptions = [ 'order' => join ( ' ' , [ static :: DEFAULT_SORT_COLUMN , static :: DEFAULT_SORT_ORDER , static :: DEFAULT_SORT_TYPE ] ) , 'offset' => 0 , 'asArray' => false ] ; $ options = array_merge ( $ defaultOptions , $ options ) ; $ options [ 'order' ] = $ this -> prepareOrderStmt ( $ options [ 'order' ] ) ; $ fromClause = "FROM " . self :: TABLE_NAME . " t " ; $ whereClause = $ this -> prepareCondition ( $ criteria , $ this -> queryParams , $ selectClause ) ; if ( $ whereClause !== '' ) { $ whereClause = 'WHERE ' . $ whereClause ; } $ selectClause = "SELECT " . implode ( ',' , $ this -> selectColumns ) ; $ sql = $ selectClause . ' ' . $ fromClause . PHP_EOL . implode ( PHP_EOL , $ this -> joins ) . PHP_EOL . $ whereClause . PHP_EOL . 'GROUP BY ' . implode ( ',' , $ this -> groupColumns ) . PHP_EOL ; $ sql .= "ORDER BY " . $ options [ 'order' ] ; if ( isset ( $ options [ 'limit' ] ) ) { $ sql = $ this -> getPersistence ( ) -> getPlatForm ( ) -> limitStatement ( $ sql , $ options [ 'limit' ] , $ options [ 'offset' ] ) ; } $ stmt = $ this -> getPersistence ( ) -> query ( $ sql , $ this -> queryParams ) ; $ data = $ stmt -> fetchAll ( \ PDO :: FETCH_ASSOC ) ; if ( $ together ) { $ ids = array_column ( $ data , static :: COLUMN_ID ) ; $ kvData = $ this -> getKvData ( $ ids ) ; foreach ( $ data as & $ row ) { if ( isset ( $ kvData [ $ row [ static :: COLUMN_ID ] ] ) ) { $ row = array_merge ( $ row , $ kvData [ $ row [ static :: COLUMN_ID ] ] ) ; } } unset ( $ row ) ; } if ( $ options [ 'asArray' ] ) { $ result = $ data ; } else { foreach ( $ data as $ row ) { $ deliveryExecution = ServiceProxy :: singleton ( ) -> getDeliveryExecution ( $ row [ self :: COLUMN_DELIVERY_EXECUTION_ID ] ) ; $ result [ ] = $ this -> buildData ( $ deliveryExecution , $ row ) ; } } return $ result ; }
Find delivery monitoring data.

Examples:
Find by delivery execution id:
------------------------------
```php
$deliveryMonitoringService->find([
['delivery_execution_id' => 'http://sample/first.rdf#i1450191587554175']
]);
```

Find by two fields with `AND` operator
--------------------------------------
```php
$deliveryMonitoringService->find([
['status' => 'active'],
['start_time' => '>1450428401'],
]);
```

Find by two fields with `OR` operator
-------------------------------------
```php
$deliveryMonitoringService->find([
['status' => 'active'],
'OR',
['start_time' => '>1450428401'],
]);
```


Combined condition
------------------
```php
$deliveryMonitoringService->find([
['status' => 'finished'],
'AND',
[['error_code' => '0'], 'OR', ['error_code' => '1']],
]);
```
supports also the following syntax
```php
$deliveryMonitoringService->find([
['status' => 'finished'],
'AND',
[['error_code' => ['0', '1']],
]);
```

@param array $criteria - criteria to find data.
The comparison operator is determined based on the first few
characters in the given value. It recognizes the following operators
if they appear as the leading characters in the given value:
<ul>
<li><code>&lt;</code>: the column must be less than the given value.</li>
<li><code>&gt;</code>: the column must be greater than the given value.</li>
<li><code>&lt;=</code>: the column must be less than or equal to the given value.</li>
<li><code>&gt;=</code>: the column must be greater than or equal to the given value.</li>
<li><code>&lt;&gt;</code>: the column must not be the same as the given value.</li>
<li><code>=</code>: the column must be equal to the given value.</li>
<li>none of the above: the column must be equal to the given value.</li>
</ul>
@param array $options
<ul>
<li>string `$options['order']='id ASC numeric'`</li>
<li>integer `$options['limit']=null`</li>
<li>integer `$options['offset']=0`</li>
<li>integer `$options['asArray']=false` whether data should be returned as multidimensional or as array of `DeliveryMonitoringData` instances</li>
</ul>
@param boolean $together - whether the secondary data should be fetched together with primary.
@return DeliveryMonitoringData[]
Find delivery monitoring data .