public function find($id = NULL)
    {
        if ($id !== NULL)
        {
            $data             = $this->getData();
            $this->currentId  = $id;
            $this->currentKey = $this->getRowKey($id);
            foreach ($data[$this->currentKey] as $field => $value)
            {
                $this->setField($field, $value);
            }
        }
        else
        {
            $this->limit(1)->findAll();
            $data = $this->data;
            if (count($data))
            {
                foreach ($data[0] as $field => $value)
                {
                    $this->setField($field, $value);
                }

                $this->currentId  = $this->getField('id');
                $this->currentKey = $this->getRowKey($this->currentId);
            }
        }
        return clone $this;
    }
public function find($id = NULL)
    {
        if ($id !== NULL)
        {
            $data             = $this->getData();
            $this->currentId  = $id;
            $this->currentKey = $this->getRowKey($id);
            foreach ($data[$this->currentKey] as $field => $value)
            {
                $this->setField($field, $value);
            }
        }
        else
        {
            $this->limit(1)->findAll();
            $data = $this->data;
            if (count($data))
            {
                foreach ($data[0] as $field => $value)
                {
                    $this->setField($field, $value);
                }

                $this->currentId  = $this->getField('id');
                $this->currentKey = $this->getRowKey($this->currentId);
            }
        }
        return clone $this;
    }
public function find ( $ id = NULL ) { if ( $ id !== NULL ) { $ data = $ this -> getData ( ) ; $ this -> currentId = $ id ; $ this -> currentKey = $ this -> getRowKey ( $ id ) ; foreach ( $ data [ $ this -> currentKey ] as $ field => $ value ) { $ this -> setField ( $ field , $ value ) ; } } else { $ this -> limit ( 1 ) -> findAll ( ) ; $ data = $ this -> data ; if ( count ( $ data ) ) { foreach ( $ data [ 0 ] as $ field => $ value ) { $ this -> setField ( $ field , $ value ) ; } $ this -> currentId = $ this -> getField ( 'id' ) ; $ this -> currentKey = $ this -> getRowKey ( $ this -> currentId ) ; } } return clone $ this ; }
Returns one row with specified ID
@param integer $id Row ID
@return self
Returns one row with specified ID