Closed akagane99 closed 8 years ago
コントローラーで同じように書いてみたけどkey指定でaftersaveと同じ1件だった。 ビヘイビアで条件追加されてそう。
$data = $model->find('all', array(
'recursive' => -1,
'conditions' => array($model->alias . '.key' => $model->data[$model->alias]['key']),
'order' => array($model->alias . '.modified DESC'),
));
CakeLog::debug(print_r($data, true));
// 'ContentComments.ContentComment',
ビヘイビアを外したらいけた。バグっぽい。
上記を実装するため、1つ前の記事が取得したかった。 しかし、afterSaveで
model->find
のall
を指定しても1件しかとれない。 なんでだ? 他の読み込んでいるビヘイビアの影響?CakeLog::debug(print_r($data, true));