/**
  * Get filtered associations
  * To be mocked...
  *
  * @param \Cake\ORM\Table $model Table
  * @return array associations
  */
 protected function _filteredAssociations(Table $model)
 {
     if (is_null($this->_associationFilter)) {
         $this->_associationFilter = new AssociationFilter();
     }
     return $this->_associationFilter->filterAssociations($model);
 }
Example #2
0
 /**
  * To be mocked elsewhere...
  *
  * @param \Cake\ORM\Table $table Table
  * @param array $aliases array of aliases
  */
 protected function _filterHasManyAssociationsAliases($table, $aliases)
 {
     if (is_null($this->_associationFilter)) {
         $this->_associationFilter = new AssociationFilter();
     }
     return $this->_associationFilter->filterHasManyAssociationsAliases($table, $aliases);
 }
Example #3
0
 /**
  * testFilterAssociations
  *
  * @return void
  */
 public function testFilterAssociationsMissingTable()
 {
     $table = TableRegistry::get('Articles', ['className' => '\\Bake\\Test\\App\\Model\\Table\\ArticlesTable']);
     $table->hasMany('Nopes');
     $result = $this->associationFilter->filterAssociations($table);
     $this->assertArrayNotHasKey('HasMany', $result);
 }