/** * Find database record by column name and its value. * This is generic method that should be used in nested classes to find its * records by some its column values. * * @param QueryInterface $query Query object instance * @param string $columnValue Column name for searching in calling class * @param string $columnName Column value * @return null|self Record instance if it was found and 4th variable has NOT been passed, * NULL if record has NOT been found and 4th variable has NOT been passed * @deprecated Record should not be queryable, query class ancestor must be used */ public static function oneByColumn(QueryInterface $query, $columnName, $columnValue) { // Perform db request and get materials return $query->entity(get_called_class())->where($columnName, $columnValue)->first(); }