Forked from McGaiser/gist:556503d067021fc9f469
Last active
February 24, 2016 06:29
-
-
Save commercial-hippie/a454b232d0d44604fa4e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Model\Table; | |
use Cake\ORM\Table; | |
use Cake\Validation\Validator; | |
use Cake\Model\Behavior\TreeBehavior; | |
class MembershipClassesTable extends AppTable { | |
public function initialize(array $config){ | |
parent::initialize($config); | |
$this->displayField('name'); | |
//Associations | |
$this->belongsTo('Affiliates'); | |
$this->belongsToMany('Roles', [ | |
'through'=>'MembershipClassesRoles', | |
'join_table'=>'membership_classes_roles', | |
'foreignKey' => 'membership_class_id', | |
'targetForeignKey' => 'role_id', | |
]); | |
$this->hasMany('PrestigeLogsMembershipClasses', [ | |
'dependant' => true, | |
'cascadeCallbacks' => true, | |
'foreignKey' => 'membership_class_id', | |
]); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
debug($this->PrestigeLogs->PrestigeLogsMembershipClasses->MembershipClasses); | |
Table "Cake\ORM\Table" is not associated with "MembershipClasses" | |
Please try correcting the issue for the following table aliases: | |
PrestigeLogsMembershipClasses |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Model\Table; | |
use Cake\ORM\Table; | |
use Cake\ORM\RulesChecker; | |
use Cake\Validation\Validator; | |
class PrestigeLogsMembershipClassesTable extends AppTable { | |
public function initialize(array $config){ | |
parent::initialize($config); | |
$this->belongsTo('PrestigeLogs'); | |
$this->belongsTo('MembershipClasses'); | |
$this->belongsTo('Officers', [ | |
'className' => 'Members', | |
'foreignKey' => 'officer_id', | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment