Answers for "bindmodel cakephp"

PHP
1

bindmodel cakephp

// Our case:
MemberNotification -> BelongsTo -> Notification, 
Notification -> HasMany -> NotificationLanguage

$this->MemberNotification->recursive = 0;
$this->set('memberNotifications', $this->paginate());
$this->MemberNotification->bindModel(array(
    'belongsTo' => array(
        'NotificationLanguage' => array(
            'foreignKey' => false,
            'conditions' => array('Notification.id = NotificationLanguage.notification_id')
        ),
    )
));

// our purpose just make the NotificationLanguage same level with the Notification, 
// so we can sort 2nd level association
Posted by: Guest on October-08-2020

Browse Popular Code Answers by Language