/** * Reads a record * * @param mixed $pk Primary key of the record * @return Model|bool Returns a Model or returns false if there is no match */ public function read($pk) { $model = new Model($this->modelName); $pkName = $model->getPK()['name']; $method = sprintf('filterBy%s', $pkName); $result = $model->{$method}($pk, Model::OPERATOR_EQUAL)->limit(1)->find(); if (is_array($result)) { # empty array if (sizeof($result) < 1) { return false; } } else { return false; } return $result[0]; }