CakePHP bake custom controller.ctp
-
05-06-2021 - |
Question
Good morning people,
I am trying to create a custom baking script for cakephp.
What I want is to be able to use the cakedc search function on all of my future pages. So far I have managed to bake in a working search form on the side of the page by altering the Views recipes.
What I would like to do now is for the baking process to identify all the fields in the tables and output something that looks like this:
public $presetVars = array(
array(
'field' => 'name',
'type' => 'value'),
array(
'field' => 'status',
'type' => 'checkbox'),
array(
'field' => 'series_id',
'type' => 'value',
'formField' => 'series_id',
'modelField' => 'lookup',
'model' => 'Series'
));
in the controller.
In case it isn't clear, this sample table has the following fields:
- id (integer)
- name (tinytext)
- status (boolean)
- series_id (integer, fk)
Is any advice available for me please?
Solution
my suggestion is edit the controller for bake:
/cake/console/libs/tasks/controller.php
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow