Lazer\Classes\Core_Database::find PHP Method

find() public method

Returns one row with specified ID
public find ( integer $id = NULL ) : Core_Database
$id integer Row ID
return Core_Database
    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->set->{$field} = $value;
            }
        } else {
            $this->limit(1)->findAll();
            $data = $this->data;
            if (count($data)) {
                foreach ($data[0] as $field => $value) {
                    $this->set->{$field} = $value;
                }
                $this->currentId = $this->set->id;
                $this->currentKey = $this->getRowKey($this->currentId);
            }
        }
        return clone $this;
    }