And, here, to cap off a really terrible brain day, is the solution, using cake’s core functionality, to the find(‘neighours’) with habtm conundrum!
$this->Mixture->bindModel(array('hasOne'=>array('MixtureCategoriesMixture')), false);
$this->set('neighbours', $this->Mixture->find('neighbors', array(
'field' => 'Mixture.sku', 'value' => $this->data['Mixture']['sku'],
'conditions'=>array(
'MixtureCategoriesMixture.default'=>1,
'MixtureCategoriesMixture.mixture_category_id'=>$this->data['MixtureCategory'][0]['id'],
'Mixture.status'=>1
)
)));
Doh, doh doh!
After some IRCing, it appears I’d misunderstood how the array should work to get the method working correctly.
$this->set('neighbours', $this->Species->find('neighbors', array(
'field' => 'Species.latin_name', 'value' => $this->data['Species']['latin_name'], 'order'=>'asc',
'conditions'=>array(
'Species.species_category_id'=>$this->data['Species']['species_category_id'],
'Species.status'=>1
)
)));
What a plonker.
Found brain, solution realised, brainfart over, seeĀ http://blog.jben.net/post/125858269/update-on-find-neighbours-with-habtm
Brain found, solution realised, brain fart over, seeĀ http://blog.jben.net/post/125844770/update-on-find-neighbours
A question came up on #cakephp about mystery open_base_dir errors, so I thought I’d document my fix. As I don’t use any other libraries when working with Cake projects, I simply removed the existing include path in /app/webroot/index.php.
on line 69 change:
ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path'));
to
ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS);
Hope this helps someone.