Model/CommonDetailModel.php
public function createDefaults($assocId) {
    $i = 1;
    $data = array();

    $foreignModel = current(Hash::extract($this->getAssociated('Parent'), 'conditions'));

    foreach ($this->defaults as $entry) {
      $data[$this->alias] = $entry;
      $data[$this->alias]['foreign_key'] = $assocId;
      $data[$this->alias]['foreign_model'] = $foreignModel;
      $data[$this->alias]['position'] = $i++;
      $this->create();
      $this->save($data);
    }
  }
public function createDefaults($assocId) {
    $i = 1;
    $data = array();

    $foreignModel = current(Hash::extract($this->getAssociated('Parent'), 'conditions'));

    foreach ($this->defaults as $entry) {
      $data[$this->alias] = $entry;
      $data[$this->alias]['foreign_key'] = $assocId;
      $data[$this->alias]['foreign_model'] = $foreignModel;
      $data[$this->alias]['position'] = $i++;
      $this->create();
      $this->save($data);
    }
  }
public function createDefaults ( $ assocId ) { $ i = 1 ; $ data = array ( ) ; $ foreignModel = current ( Hash :: extract ( $ this -> getAssociated ( 'Parent' ) , 'conditions' ) ) ; foreach ( $ this -> defaults as $ entry ) { $ data [ $ this -> alias ] = $ entry ; $ data [ $ this -> alias ] [ 'foreign_key' ] = $ assocId ; $ data [ $ this -> alias ] [ 'foreign_model' ] = $ foreignModel ; $ data [ $ this -> alias ] [ 'position' ] = $ i ++ ; $ this -> create ( ) ; $ this -> save ( $ data ) ; } }
Creates default "details" entries for associated model's record.

@param integer|string $assocId Associated record ID.
@return void
Creates default details entries for associated model s record .