/** * Fetches a record matching the specified conditions. * * The model's {@link fetch_records} prototype method is used to retrieve the record. * * @param Model|ModelBindings $model * @param array $conditions * @param Fetcher $fetcher If the parameter `fetcher` is present, the {@link Fetcher} * instance used to fetch the record is stored inside. * * @return ActiveRecord|null */ public static function fetch_record(Model $model, array $conditions, &$fetcher = null) { $records = $model->fetch_records($conditions + ['limit' => 1]); if (!$records) { return null; } $fetcher = $records->fetcher; return $records->one; }