public function findOne($conditions = [], $order = null)
    {
        // Event
        $this->triggerEvent(
            'onBefore' . ucfirst(__FUNCTION__),
            [
                'conditions' => &$conditions,
                'order' => &$order,
            ]
        );

        $dataset = $this->find($conditions, $order, 0, 1);

        $result = $dataset[0];

        if (!$result) {
            $class = $this->dataClass;
            $result = new $class();
        }

        // Event
        $this->triggerEvent(
            'onAfter' . ucfirst(__FUNCTION__),
            [
                'result' => &$result,
            ]
        );

        return $result;
    }
public function findOne($conditions = [], $order = null)
    {
        // Event
        $this->triggerEvent(
            'onBefore' . ucfirst(__FUNCTION__),
            [
                'conditions' => &$conditions,
                'order' => &$order,
            ]
        );

        $dataset = $this->find($conditions, $order, 0, 1);

        $result = $dataset[0];

        if (!$result) {
            $class = $this->dataClass;
            $result = new $class();
        }

        // Event
        $this->triggerEvent(
            'onAfter' . ucfirst(__FUNCTION__),
            [
                'result' => &$result,
            ]
        );

        return $result;
    }
public function findOne ( $ conditions = [ ] , $ order = null ) { // Event $ this -> triggerEvent ( 'onBefore' . ucfirst ( __FUNCTION__ ) , [ 'conditions' => & $ conditions , 'order' => & $ order , ] ) ; $ dataset = $ this -> find ( $ conditions , $ order , 0 , 1 ) ; $ result = $ dataset [ 0 ] ; if ( ! $ result ) { $ class = $ this -> dataClass ; $ result = new $ class ( ) ; } // Event $ this -> triggerEvent ( 'onAfter' . ucfirst ( __FUNCTION__ ) , [ 'result' => & $ result , ] ) ; return $ result ; }
Find one record and return a data.

Same as `$mapper->find($conditions, 'id', 0, 1);`

@param mixed $conditions Where conditions, you can use array or Compare object.
Example:
- `array('id' => 5)` => id = 5
- `new GteCompare('id', 20)` => 'id >= 20'
- `new Compare('id', '%Flower%', 'LIKE')` => 'id LIKE "%Flower%"'
@param mixed $order      Order sort, can ba string, array or object.
Example:
- `id ASC` => ORDER BY id ASC
- `array('catid DESC', 'id')` => ORDER BY catid DESC, id

@return mixed|Data Found row data.
Find one record and return a data .