Return related models for CommentsController::requestForUser()
Closed this issue · 1 comments
ajibarra commented
Reported by Predominant | September 23rd, 2010 @ 07:55 AM
"Return also related models: find a way to automatically bind related models to comments"
Note:
This ticket was converted from an inline comment.
skie commented
In model possible overload behavior commentBeforeFind method like this
/**
-
Prepare models association to before fetch data
* -
@param array $options
-
@return boolean
-
@access public
*/
public function commentBeforeFind($options) {
$result = $this->Behaviors->dispatchMethod($this, 'commentBeforeFind', array($options));$userModel = $this->Behaviors->Commentable->settings[$this->alias]['userModelAlias']; $this->Comment->bindModel(array('belongsTo' => array( 'Profile' => array( 'className' => 'Profile', 'foreignKey' => false, 'conditions' => array('Profile.user_id = ' . $userModel . '.id') ) )), false); return $result;
}