Re: Records search using CakeDC/search

2013-09-26 Thread cakenewb
I know this is thread is a little old, but I'm having the same problem and 
just can't seem to resolve it.  The query being generated is missing 
conditions for reasons I can't figure out:

SELECT `Book`.`book_id`, `Book`.`isbn13`, `Book`.`isbn10`, `Book`.`series`, 
`Book`.`format`, `Book`.`title`, `Book`.`title_prefix`, 
`Book`.`title_without_prefix`, `Book`.`subtitle`, `Book`.`language`, 
`Book`.`pages`, `Book`.`basic`, `Book`.`audience`, `Book`.`age_from`, 
`Book`.`age_to`, `Book`.`grade_from`, `Book`.`grade_to`, 
`Book`.`main_desc`, `Book`.`bio_note`, `Book`.`review_quote`, 
`Book`.`imprint`, `Book`.`publisher`, `Book`.`pub_status`, 
`Book`.`pub_date`, `Book`.`height`, `Book`.`width`, `Book`.`url`, 
`Book`.`extras` FROM `titles`.`books` AS `Book`   WHERE 1 = 1LIMIT 20
The weird thing is that when I debug the search action line: 
debug($this->paginate['conditions'] 
= $this->Book->parseCriteria($this->passedArgs));
I do get an array with the condition: array( 'Book.title LIKE' => '%sweet%' 
)

I'm not sure where this condition goes missing!
Thanks for anything you can help with.

On Monday, 15 April 2013 19:14:46 UTC-4, cricket wrote:
>
> What does the resulting query look like? Does it include the condition 
> with the submitted name?
>
>
> On Mon, Apr 15, 2013 at 1:44 AM, Muhammad Asyraf 
> 
> > wrote:
>
>> Actually i already Google several search plugin for CakePHP but most of 
>> CakePHP user recommended search plugin from CakeDC. So, i download the 
>> plugin from https://github.com/dereuromark/search and load the plugin 
>> with code: CakePlugin::load('Search'); in bootstrap.php
>>
>> Then i implement the code for my file controller:
>>
>> public $components = array('Search.Prg');
>> public $presetVars = true; // using the model configuration
>> public function find() {
>> $this->Prg->commonProcess();
>> $this->paginate['conditions'] = 
>> $this->Patient->parseCriteria($this->passedArgs);
>> $this->set('patients', $this->paginate());
>> }
>> *
>> *
>> *
>> *
>> For the model, i put this code:
>>
>> public $actsAs = array('Search.Searchable');
>> public $filterArgs = array(
>> array('name' => 'name', 'type' => 'query', 'method' => 
>> 'filterName'),
>> );
>>
>> public function filterName($data, $field = null) {
>> if (empty($data['name'])) {
>> return array();
>> }
>> $nameField = '%' . $data['name'] . '%';
>> return array(
>> 'OR' => array(
>> $this->alias . '.name LIKE' => $nameField,
>> ));
>> }
>>
>> For the view (find.ctp), i put this code for the form: (others code are 
>> exactly same as view/index.ctp)
>>
>> > echo $this->Form->create('Patient', array(
>> 'url' => array_merge(array('action' => 'find'), $this->params['pass'])
>> ));
>> echo $this->Form->input('name', array('div' => false));
>> echo $this->Form->submit(__('Search'), array('div' => false));
>> echo $this->Form->end();
>> ?>
>>
>>
>> What i try to achieve is the search plugin will do searching for "name" 
>> from table patients. However, this code seems not working but in the URL, 
>> once i do searching for example i "John" as the search term, the URL bar 
>> show as patients/find/name:john but the list of record are not showing john 
>> record only but still show all records instead of john only. 
>>
>> As for the information i use CakePHP ver: 2.3.1. Is it any problem with 
>> the codes or any depreciate attributes in the coding? Sorry if this 
>> question repeated in this group but i still unable to find any solution. 
>> Most of the user claimed that it is easy to use this plugin but i'm still 
>> new in CakePHP. Hope someone can help me. 
>>
>> Thanks :)
>>
>>  -- 
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "CakePHP" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to cake-php+u...@googlegroups.com .
>> To post to this group, send email to cake...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Records search using CakeDC/search

2013-09-26 Thread cakenewb


On Monday, 15 April 2013 19:09:01 UTC-4, cricket wrote:
>
> You can get rid of that notice by declaring the $paginate array as a class 
> var:
>
> public $paginate = array();
> public $components = ...
>
>
> On Mon, Apr 15, 2013 at 8:22 AM, Muhammad Asyraf 
> 
> > wrote:
>
>> I've made the amendment to the code but still the result are same. no 
>> search result produced and i notice there is warning on top of the page say:
>>
>>  Notice (8): Indirect modification of overloaded property 
>> PatientsController::$paginate has no effect 
>> [APP\Controller\PatientsController.php, line 14] 
>>
>> where the code that caused the notice to appear is:
>>
>>  $this->paginate['conditions'] = 
>> $this->Patient->parseCriteria($this->passedArgs);
>>
>> is there any other codes that i've missed? Thanks a lot :)
>>
>>  
>> On Monday, 15 April 2013 18:07:18 UTC+8, euromark wrote:
>>>
>>> I would use string array keys:
>>>
>>> public $filterArgs = array(
>>> 'name' => array('type' => 'query', 'method' => 'filterName'),
>>> );
>>>
>>> but both ways should work
>>>
>>> PS: echo $this->Form->create('Patient') is enough, as it automatically 
>>> posts to itself
>>>
>>>
>>>
>>> Am Montag, 15. April 2013 07:44:40 UTC+2 schrieb Muhammad Asyraf:

 Actually i already Google several search plugin for CakePHP but most of 
 CakePHP user recommended search plugin from CakeDC. So, i download the 
 plugin from 
 https://github.com/**dereuromark/search
  and 
 load the plugin with code: CakePlugin::load('**Search'); in 
 bootstrap.php

 Then i implement the code for my file controller:

 public $components = array('Search.Prg');
 public $presetVars = true; // using the model configuration
 public function find() {
 $this->Prg->commonProcess();
 $this->paginate['conditions'] = $this->Patient->parseCriteria(*
 *$this->passedArgs);
 $this->set('patients', $this->paginate());
 }
 *
 *
 *
 *
 For the model, i put this code:

 public $actsAs = array('Search.Searchable');
 public $filterArgs = array(
 array('name' => 'name', 'type' => 'query', 'method' => 
 'filterName'),
 );

 public function filterName($data, $field = null) {
 if (empty($data['name'])) {
 return array();
 }
 $nameField = '%' . $data['name'] . '%';
 return array(
 'OR' => array(
 $this->alias . '.name LIKE' => $nameField,
 ));
 }

 For the view (find.ctp), i put this code for the form: (others code are 
 exactly same as view/index.ctp)

 >>> echo $this->Form->create('Patient', array(
 'url' => array_merge(array('action' => 'find'), $this->params['pass'])
 ));
 echo $this->Form->input('name', array('div' => false));
 echo $this->Form->submit(__('**Search'), array('div' => false));
 echo $this->Form->end();
 ?>


 What i try to achieve is the search plugin will do searching for "name" 
 from table patients. However, this code seems not working but in the URL, 
 once i do searching for example i "John" as the search term, the URL bar 
 show as patients/find/name:john but the list of record are not showing 
 john 
 record only but still show all records instead of john only. 

 As for the information i use CakePHP ver: 2.3.1. Is it any problem with 
 the codes or any depreciate attributes in the coding? Sorry if this 
 question repeated in this group but i still unable to find any solution. 
 Most of the user claimed that it is easy to use this plugin but i'm still 
 new in CakePHP. Hope someone can help me. 

 Thanks :)

  -- 
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "CakePHP" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to cake-php+u...@googlegroups.com .
>> To post to this group, send email to cake...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit htt

Re: Records search using CakeDC/search

2013-04-15 Thread Muhammad Asyraf
currently the searching only for searching for name field. the result only 
select the name that equivalent to the search query. now i try to create 
condition for example like search based on name and gender. need to figure 
out how to do that.hmmm 

On Tuesday, 16 April 2013 07:14:46 UTC+8, cricket wrote:
>
> What does the resulting query look like? Does it include the condition 
> with the submitted name?
>
>
> On Mon, Apr 15, 2013 at 1:44 AM, Muhammad Asyraf 
> 
> > wrote:
>
>> Actually i already Google several search plugin for CakePHP but most of 
>> CakePHP user recommended search plugin from CakeDC. So, i download the 
>> plugin from https://github.com/dereuromark/search and load the plugin 
>> with code: CakePlugin::load('Search'); in bootstrap.php
>>
>> Then i implement the code for my file controller:
>>
>> public $components = array('Search.Prg');
>> public $presetVars = true; // using the model configuration
>> public function find() {
>> $this->Prg->commonProcess();
>> $this->paginate['conditions'] = 
>> $this->Patient->parseCriteria($this->passedArgs);
>> $this->set('patients', $this->paginate());
>> }
>> *
>> *
>> *
>> *
>> For the model, i put this code:
>>
>> public $actsAs = array('Search.Searchable');
>> public $filterArgs = array(
>> array('name' => 'name', 'type' => 'query', 'method' => 
>> 'filterName'),
>> );
>>
>> public function filterName($data, $field = null) {
>> if (empty($data['name'])) {
>> return array();
>> }
>> $nameField = '%' . $data['name'] . '%';
>> return array(
>> 'OR' => array(
>> $this->alias . '.name LIKE' => $nameField,
>> ));
>> }
>>
>> For the view (find.ctp), i put this code for the form: (others code are 
>> exactly same as view/index.ctp)
>>
>> > echo $this->Form->create('Patient', array(
>> 'url' => array_merge(array('action' => 'find'), $this->params['pass'])
>> ));
>> echo $this->Form->input('name', array('div' => false));
>> echo $this->Form->submit(__('Search'), array('div' => false));
>> echo $this->Form->end();
>> ?>
>>
>>
>> What i try to achieve is the search plugin will do searching for "name" 
>> from table patients. However, this code seems not working but in the URL, 
>> once i do searching for example i "John" as the search term, the URL bar 
>> show as patients/find/name:john but the list of record are not showing john 
>> record only but still show all records instead of john only. 
>>
>> As for the information i use CakePHP ver: 2.3.1. Is it any problem with 
>> the codes or any depreciate attributes in the coding? Sorry if this 
>> question repeated in this group but i still unable to find any solution. 
>> Most of the user claimed that it is easy to use this plugin but i'm still 
>> new in CakePHP. Hope someone can help me. 
>>
>> Thanks :)
>>
>>  -- 
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "CakePHP" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to cake-php+u...@googlegroups.com .
>> To post to this group, send email to cake...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Records search using CakeDC/search

2013-04-15 Thread Muhammad Asyraf
It works now! thank you so much euromark and cricket!!! really appreciate 
your help man! Just a single line of code can solve the problem. nice! 

On Tuesday, 16 April 2013 07:09:01 UTC+8, cricket wrote:
>
> You can get rid of that notice by declaring the $paginate array as a class 
> var:
>
> public $paginate = array();
> public $components = ...
>
>
> On Mon, Apr 15, 2013 at 8:22 AM, Muhammad Asyraf 
> 
> > wrote:
>
>> I've made the amendment to the code but still the result are same. no 
>> search result produced and i notice there is warning on top of the page say:
>>
>>  Notice (8): Indirect modification of overloaded property 
>> PatientsController::$paginate has no effect 
>> [APP\Controller\PatientsController.php, line 14] 
>>
>> where the code that caused the notice to appear is:
>>
>>  $this->paginate['conditions'] = 
>> $this->Patient->parseCriteria($this->passedArgs);
>>
>> is there any other codes that i've missed? Thanks a lot :)
>>
>>  
>> On Monday, 15 April 2013 18:07:18 UTC+8, euromark wrote:
>>>
>>> I would use string array keys:
>>>
>>> public $filterArgs = array(
>>> 'name' => array('type' => 'query', 'method' => 'filterName'),
>>> );
>>>
>>> but both ways should work
>>>
>>> PS: echo $this->Form->create('Patient') is enough, as it automatically 
>>> posts to itself
>>>
>>>
>>>
>>> Am Montag, 15. April 2013 07:44:40 UTC+2 schrieb Muhammad Asyraf:

 Actually i already Google several search plugin for CakePHP but most of 
 CakePHP user recommended search plugin from CakeDC. So, i download the 
 plugin from 
 https://github.com/**dereuromark/search
  and 
 load the plugin with code: CakePlugin::load('**Search'); in 
 bootstrap.php

 Then i implement the code for my file controller:

 public $components = array('Search.Prg');
 public $presetVars = true; // using the model configuration
 public function find() {
 $this->Prg->commonProcess();
 $this->paginate['conditions'] = $this->Patient->parseCriteria(*
 *$this->passedArgs);
 $this->set('patients', $this->paginate());
 }
 *
 *
 *
 *
 For the model, i put this code:

 public $actsAs = array('Search.Searchable');
 public $filterArgs = array(
 array('name' => 'name', 'type' => 'query', 'method' => 
 'filterName'),
 );

 public function filterName($data, $field = null) {
 if (empty($data['name'])) {
 return array();
 }
 $nameField = '%' . $data['name'] . '%';
 return array(
 'OR' => array(
 $this->alias . '.name LIKE' => $nameField,
 ));
 }

 For the view (find.ctp), i put this code for the form: (others code are 
 exactly same as view/index.ctp)

 >>> echo $this->Form->create('Patient', array(
 'url' => array_merge(array('action' => 'find'), $this->params['pass'])
 ));
 echo $this->Form->input('name', array('div' => false));
 echo $this->Form->submit(__('**Search'), array('div' => false));
 echo $this->Form->end();
 ?>


 What i try to achieve is the search plugin will do searching for "name" 
 from table patients. However, this code seems not working but in the URL, 
 once i do searching for example i "John" as the search term, the URL bar 
 show as patients/find/name:john but the list of record are not showing 
 john 
 record only but still show all records instead of john only. 

 As for the information i use CakePHP ver: 2.3.1. Is it any problem with 
 the codes or any depreciate attributes in the coding? Sorry if this 
 question repeated in this group but i still unable to find any solution. 
 Most of the user claimed that it is easy to use this plugin but i'm still 
 new in CakePHP. Hope someone can help me. 

 Thanks :)

  -- 
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "CakePHP" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to cake-php+u...@googlegroups.com .
>> To post to this group, send email to cake...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To po

Re: Records search using CakeDC/search

2013-04-15 Thread lowpass
What does the resulting query look like? Does it include the condition with
the submitted name?


On Mon, Apr 15, 2013 at 1:44 AM, Muhammad Asyraf wrote:

> Actually i already Google several search plugin for CakePHP but most of
> CakePHP user recommended search plugin from CakeDC. So, i download the
> plugin from https://github.com/dereuromark/search and load the plugin
> with code: CakePlugin::load('Search'); in bootstrap.php
>
> Then i implement the code for my file controller:
>
> public $components = array('Search.Prg');
> public $presetVars = true; // using the model configuration
> public function find() {
> $this->Prg->commonProcess();
> $this->paginate['conditions'] =
> $this->Patient->parseCriteria($this->passedArgs);
> $this->set('patients', $this->paginate());
> }
> *
> *
> *
> *
> For the model, i put this code:
>
> public $actsAs = array('Search.Searchable');
> public $filterArgs = array(
> array('name' => 'name', 'type' => 'query', 'method' =>
> 'filterName'),
> );
>
> public function filterName($data, $field = null) {
> if (empty($data['name'])) {
> return array();
> }
> $nameField = '%' . $data['name'] . '%';
> return array(
> 'OR' => array(
> $this->alias . '.name LIKE' => $nameField,
> ));
> }
>
> For the view (find.ctp), i put this code for the form: (others code are
> exactly same as view/index.ctp)
>
>  echo $this->Form->create('Patient', array(
> 'url' => array_merge(array('action' => 'find'), $this->params['pass'])
> ));
> echo $this->Form->input('name', array('div' => false));
> echo $this->Form->submit(__('Search'), array('div' => false));
> echo $this->Form->end();
> ?>
>
>
> What i try to achieve is the search plugin will do searching for "name"
> from table patients. However, this code seems not working but in the URL,
> once i do searching for example i "John" as the search term, the URL bar
> show as patients/find/name:john but the list of record are not showing john
> record only but still show all records instead of john only.
>
> As for the information i use CakePHP ver: 2.3.1. Is it any problem with
> the codes or any depreciate attributes in the coding? Sorry if this
> question repeated in this group but i still unable to find any solution.
> Most of the user claimed that it is easy to use this plugin but i'm still
> new in CakePHP. Hope someone can help me.
>
> Thanks :)
>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Records search using CakeDC/search

2013-04-15 Thread lowpass
You can get rid of that notice by declaring the $paginate array as a class
var:

public $paginate = array();
public $components = ...


On Mon, Apr 15, 2013 at 8:22 AM, Muhammad Asyraf wrote:

> I've made the amendment to the code but still the result are same. no
> search result produced and i notice there is warning on top of the page say:
>
>  Notice (8): Indirect modification of overloaded property
> PatientsController::$paginate has no effect
> [APP\Controller\PatientsController.php, line 14]
>
> where the code that caused the notice to appear is:
>
>  $this->paginate['conditions'] =
> $this->Patient->parseCriteria($this->passedArgs);
>
> is there any other codes that i've missed? Thanks a lot :)
>
>
> On Monday, 15 April 2013 18:07:18 UTC+8, euromark wrote:
>>
>> I would use string array keys:
>>
>> public $filterArgs = array(
>> 'name' => array('type' => 'query', 'method' => 'filterName'),
>> );
>>
>> but both ways should work
>>
>> PS: echo $this->Form->create('Patient') is enough, as it automatically
>> posts to itself
>>
>>
>>
>> Am Montag, 15. April 2013 07:44:40 UTC+2 schrieb Muhammad Asyraf:
>>>
>>> Actually i already Google several search plugin for CakePHP but most of
>>> CakePHP user recommended search plugin from CakeDC. So, i download the
>>> plugin from 
>>> https://github.com/**dereuromark/search
>>>  and
>>> load the plugin with code: CakePlugin::load('**Search'); in
>>> bootstrap.php
>>>
>>> Then i implement the code for my file controller:
>>>
>>> public $components = array('Search.Prg');
>>> public $presetVars = true; // using the model configuration
>>> public function find() {
>>> $this->Prg->commonProcess();
>>> $this->paginate['conditions'] = $this->Patient->parseCriteria(**
>>> $this->passedArgs);
>>> $this->set('patients', $this->paginate());
>>> }
>>> *
>>> *
>>> *
>>> *
>>> For the model, i put this code:
>>>
>>> public $actsAs = array('Search.Searchable');
>>> public $filterArgs = array(
>>> array('name' => 'name', 'type' => 'query', 'method' =>
>>> 'filterName'),
>>> );
>>>
>>> public function filterName($data, $field = null) {
>>> if (empty($data['name'])) {
>>> return array();
>>> }
>>> $nameField = '%' . $data['name'] . '%';
>>> return array(
>>> 'OR' => array(
>>> $this->alias . '.name LIKE' => $nameField,
>>> ));
>>> }
>>>
>>> For the view (find.ctp), i put this code for the form: (others code are
>>> exactly same as view/index.ctp)
>>>
>>> >> echo $this->Form->create('Patient', array(
>>> 'url' => array_merge(array('action' => 'find'), $this->params['pass'])
>>> ));
>>> echo $this->Form->input('name', array('div' => false));
>>> echo $this->Form->submit(__('**Search'), array('div' => false));
>>> echo $this->Form->end();
>>> ?>
>>>
>>>
>>> What i try to achieve is the search plugin will do searching for "name"
>>> from table patients. However, this code seems not working but in the URL,
>>> once i do searching for example i "John" as the search term, the URL bar
>>> show as patients/find/name:john but the list of record are not showing john
>>> record only but still show all records instead of john only.
>>>
>>> As for the information i use CakePHP ver: 2.3.1. Is it any problem with
>>> the codes or any depreciate attributes in the coding? Sorry if this
>>> question repeated in this group but i still unable to find any solution.
>>> Most of the user claimed that it is easy to use this plugin but i'm still
>>> new in CakePHP. Hope someone can help me.
>>>
>>> Thanks :)
>>>
>>>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Records search using CakeDC/search

2013-04-15 Thread Muhammad Asyraf
I've made the amendment to the code but still the result are same. no 
search result produced and i notice there is warning on top of the page say:

 Notice (8): Indirect modification of overloaded property 
PatientsController::$paginate has no effect 
[APP\Controller\PatientsController.php, line 14] 

where the code that caused the notice to appear is:

 $this->paginate['conditions'] = 
$this->Patient->parseCriteria($this->passedArgs);

is there any other codes that i've missed? Thanks a lot :)
 
On Monday, 15 April 2013 18:07:18 UTC+8, euromark wrote:
>
> I would use string array keys:
>
> public $filterArgs = array(
> 'name' => array('type' => 'query', 'method' => 'filterName'),
> );
>
> but both ways should work
>
> PS: echo $this->Form->create('Patient') is enough, as it automatically 
> posts to itself
>
>
>
> Am Montag, 15. April 2013 07:44:40 UTC+2 schrieb Muhammad Asyraf:
>>
>> Actually i already Google several search plugin for CakePHP but most of 
>> CakePHP user recommended search plugin from CakeDC. So, i download the 
>> plugin from https://github.com/dereuromark/search and load the plugin 
>> with code: CakePlugin::load('Search'); in bootstrap.php
>>
>> Then i implement the code for my file controller:
>>
>> public $components = array('Search.Prg');
>> public $presetVars = true; // using the model configuration
>> public function find() {
>> $this->Prg->commonProcess();
>> $this->paginate['conditions'] = 
>> $this->Patient->parseCriteria($this->passedArgs);
>> $this->set('patients', $this->paginate());
>> }
>> *
>> *
>> *
>> *
>> For the model, i put this code:
>>
>> public $actsAs = array('Search.Searchable');
>> public $filterArgs = array(
>> array('name' => 'name', 'type' => 'query', 'method' => 
>> 'filterName'),
>> );
>>
>> public function filterName($data, $field = null) {
>> if (empty($data['name'])) {
>> return array();
>> }
>> $nameField = '%' . $data['name'] . '%';
>> return array(
>> 'OR' => array(
>> $this->alias . '.name LIKE' => $nameField,
>> ));
>> }
>>
>> For the view (find.ctp), i put this code for the form: (others code are 
>> exactly same as view/index.ctp)
>>
>> > echo $this->Form->create('Patient', array(
>> 'url' => array_merge(array('action' => 'find'), $this->params['pass'])
>> ));
>> echo $this->Form->input('name', array('div' => false));
>> echo $this->Form->submit(__('Search'), array('div' => false));
>> echo $this->Form->end();
>> ?>
>>
>>
>> What i try to achieve is the search plugin will do searching for "name" 
>> from table patients. However, this code seems not working but in the URL, 
>> once i do searching for example i "John" as the search term, the URL bar 
>> show as patients/find/name:john but the list of record are not showing john 
>> record only but still show all records instead of john only. 
>>
>> As for the information i use CakePHP ver: 2.3.1. Is it any problem with 
>> the codes or any depreciate attributes in the coding? Sorry if this 
>> question repeated in this group but i still unable to find any solution. 
>> Most of the user claimed that it is easy to use this plugin but i'm still 
>> new in CakePHP. Hope someone can help me. 
>>
>> Thanks :)
>>
>>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Records search using CakeDC/search

2013-04-15 Thread euromark
I would use string array keys:

public $filterArgs = array(
'name' => array('type' => 'query', 'method' => 'filterName'),
);

but both ways should work

PS: echo $this->Form->create('Patient') is enough, as it automatically 
posts to itself



Am Montag, 15. April 2013 07:44:40 UTC+2 schrieb Muhammad Asyraf:
>
> Actually i already Google several search plugin for CakePHP but most of 
> CakePHP user recommended search plugin from CakeDC. So, i download the 
> plugin from https://github.com/dereuromark/search and load the plugin 
> with code: CakePlugin::load('Search'); in bootstrap.php
>
> Then i implement the code for my file controller:
>
> public $components = array('Search.Prg');
> public $presetVars = true; // using the model configuration
> public function find() {
> $this->Prg->commonProcess();
> $this->paginate['conditions'] = 
> $this->Patient->parseCriteria($this->passedArgs);
> $this->set('patients', $this->paginate());
> }
> *
> *
> *
> *
> For the model, i put this code:
>
> public $actsAs = array('Search.Searchable');
> public $filterArgs = array(
> array('name' => 'name', 'type' => 'query', 'method' => 
> 'filterName'),
> );
>
> public function filterName($data, $field = null) {
> if (empty($data['name'])) {
> return array();
> }
> $nameField = '%' . $data['name'] . '%';
> return array(
> 'OR' => array(
> $this->alias . '.name LIKE' => $nameField,
> ));
> }
>
> For the view (find.ctp), i put this code for the form: (others code are 
> exactly same as view/index.ctp)
>
>  echo $this->Form->create('Patient', array(
> 'url' => array_merge(array('action' => 'find'), $this->params['pass'])
> ));
> echo $this->Form->input('name', array('div' => false));
> echo $this->Form->submit(__('Search'), array('div' => false));
> echo $this->Form->end();
> ?>
>
>
> What i try to achieve is the search plugin will do searching for "name" 
> from table patients. However, this code seems not working but in the URL, 
> once i do searching for example i "John" as the search term, the URL bar 
> show as patients/find/name:john but the list of record are not showing john 
> record only but still show all records instead of john only. 
>
> As for the information i use CakePHP ver: 2.3.1. Is it any problem with 
> the codes or any depreciate attributes in the coding? Sorry if this 
> question repeated in this group but i still unable to find any solution. 
> Most of the user claimed that it is easy to use this plugin but i'm still 
> new in CakePHP. Hope someone can help me. 
>
> Thanks :)
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.