Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- App::uses('AppModel', 'Model');
- /**
- * Influencer Model
- *
- * @property User $User
- * @property EventInvite $EventInvite
- * @property Club $Club
- */
- class Influencer extends AppModel {
- /**
- * Display field
- *
- * @var string
- */
- public $displayField = 'id';
- //The Associations below have been created with all possible keys, those that are not needed can be removed
- /**
- * belongsTo associations
- *
- * @var array
- */
- public $belongsTo = array(
- 'User' => array(
- 'className' => 'User',
- 'foreignKey' => 'user_id',
- 'conditions' => '',
- 'fields' => '',
- 'order' => ''
- )
- );
- /**
- * hasMany associations
- *
- * @var array
- */
- public $hasMany = array(
- 'EventInvite' => array(
- 'className' => 'EventInvite',
- 'foreignKey' => 'influencer_id',
- 'dependent' => false,
- 'conditions' => '',
- 'fields' => '',
- 'order' => '',
- 'limit' => '',
- 'offset' => '',
- 'exclusive' => '',
- 'finderQuery' => '',
- 'counterQuery' => ''
- )
- );
- /**
- * hasAndBelongsToMany associations
- *
- * @var array
- */
- public $hasAndBelongsToMany = array(
- 'Club' => array(
- 'className' => 'Club',
- 'joinTable' => 'clubs_influencers',
- 'foreignKey' => 'influencer_id',
- 'associationForeignKey' => 'club_id',
- 'unique' => 'keepExisting',
- 'conditions' => '',
- 'fields' => '',
- 'order' => '',
- 'limit' => '',
- 'offset' => '',
- 'finderQuery' => '',
- )
- );
- /**
- * Function for adding an influencer
- * @param [type] $data
- */
- public function addInfluencer($data){
- //influencers group is 9
- $data['User']['Group']['id'] = 9;
- // Default language English
- $data['User']['language_id'] = 1;
- //set the clubid to the club that you're currently logged in to or/and viewing
- $data['Club']['id']=$clubId;
- $data = $this->ClubsInfluencer->saveAll($data);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement