tags:

views:

527

answers:

1

I wanted to implement a search feature in my cakephp application. I found this article for implementing cakephp search. http://bakery.cakephp.org/articles/view/search-feature-to-cakephp-blog-example

It had a google code repository found here: http://code.google.com/p/searchable-behaviour-for-cakephp/

Things seemed to work okay until I ran into an issue trying to save a search able model from another controller.

  1. Model A and Model B are search able
  2. From Controller A, I call $this->Model B->save

Index fails and throws error because searchable.php behavior is trying to use Model A as the saving Model

I posted this on the issue board of the google code page for this feature, but I have received no responses. I figured that I would give stackoverflow a shot.

Thanks!

I do have this line in Model A and Model B var $actsAs = array('Searchable');

These two models do no have any direct relationships

Call from Controller A $this->Model B->create(); $this->Model B->save($this->data, array('validate' => 'false'));

Error I'm receiving Warning (2): Invalid argument supplied for foreach() [APP/models/behaviors/searchable.php, line 86]

frodosghost, does this functionality work in your environment?

A: 

I am guessing it would be around your $this->Model B->save call you make. Your relationships would have to be setup correctly.

I would like to see your relationships from model A to model B and also if you have the var $actsAs = array ('Searchable'); on your model B.

frodosghost