0

Hi I am really new in CakePhp, I hope you can help me

    class BookingsController extends AppController {

    public $helpers = array("PDF");
//public $virtualFields = array(
// 'full_name' => 'CONCAT(Customer.cust_fname, ", ", Customer.cust_fname)'
//);
    public $components = array('RequestHandler');

    public $components = array('Search.Prg');

    public $presetVars = array(
        array('field' => 'search', 'type' => 'value'),
    );
/**

My question now is that I need $components in both. Is there any way to merge it together? Or how can I call both request handler and search.prg? I hope u can help

  • It looks more like you're new to php or at least OOP in php when you try to declare two properties with the same name. So before trying to use a framework that is heavily using OOP you might learn that first? – floriank Oct 16 '13 at 21:14

2 Answers2

1
public $components = array('RequestHandler', 'Search.Prg');
Ayo Akinyemi
  • 792
  • 4
  • 7
1

Simply merge the arrays

public $components = array('RequestHandler', 
                           'Search.Prg', 
                           'OtherComponent', 
                           'ExtraComponent' /*etc*/);

Cake is smart enough to get what you mean. Also works for $helpers and $uses... and I guess pretty much everything really. You need to keep an eye on documentation, it says clearly how to do what you asked.

Nunser
  • 4,512
  • 8
  • 25
  • 37