Это мой пользовательский метод поиска внутри DynamicViewsTable.php
public function findAccessibleByUser(Query $query, array $options) { if (empty($options['User']['id'])) { throw new Exception("Current User not set", 1); } $query->select(['DynamicViews.id', 'DynamicViews.title', 'UsersAccessDynamicViews.ordinal_ranking']) ->contain(['UsersAccessDynamicViews']) ->where([ 'UsersAccessDynamicViews.user_id' => $options['User']['id'], ]) ->order(['UsersAccessDynamicViews.ordinal_ranking' => 'ASC']); return $query; }
Ошибка, которую я продолжаю получать:
Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'UsersAccessDynamicViews.ordinal_ranking' in 'field list'
и запрос, показанный на странице ошибки:
SELECT DynamicViews.id AS `DynamicViews__id`, DynamicViews.title AS `DynamicViews__title`, UsersAccessDynamicViews.ordinal_ranking AS `UsersAccessDynamicViews__ordinal_ranking` FROM dynamic_views DynamicViews WHERE UsersAccessDynamicViews.user_id = :c0 ORDER BY UsersAccessDynamicViews.ordinal_ranking ASC
DynamicViewsMany UsersAccessDynamicViews