我试图按照cakephp 3上的手册中的示例;
http://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#custom-finder-methods
The method getJSONObject(int) in the type JSONArray is not applicable for the arguments (String)
我一直得到同样的错误;
尝试获取非对象的属性 [APP / Model \ Table \ BookmarksTable.php,第108行]
代码上下文 { $ user = $ options ['user'];
use Cake\ORM\Query;
use Cake\ORM\Table;
class ArticlesTable extends Table
{
public function findOwnedBy(Query $query, array $options)
{
$user = $options['user'];
return $query->where(['author_id' => $user->id]);
}
}
// In a controller or table method.
$articles = TableRegistry::get('Articles');
$query = $articles->find('ownedBy', ['user' => $userEntity]);
它指向该行;
$ user = $ options ['user'];
这条线怎么了?
答案 0 :(得分:0)
Nvm向该方法传递了错误的值。