Reputation: 894
Is there a way to make the CakePHP bake command assign the field description (as it is on the database) as the labels of a form?
For example, if the table definition is as follows:
CREATE TABLE `equipment` (
`equ_pk` int(11) NOT NULL AUTO_INCREMENT,
`equ_desc` varchar(60) NOT NULL COMMENT 'Description',
`equ_code` varchar(10) NOT NULL COMMENT 'Code',
PRIMARY KEY (`equ_pk`),
UNIQUE KEY `equ_code_UNIQUE` (`equ_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Then in the labels of the form would be "Description" and "Code".
By default, the bake command make them "equ_desc" and "equ_code".
Upvotes: 2
Views: 351
Reputation: 8540
I don't believe this is possible with bake as it sounds like a rather bespoke situation (someone correct me if I'm wrong). However, you can alter your baked forms and override the labels generated using the label
option on the form inputs like this:-
<?= $this->Form->input('equ_desc', ['label' => __('Description')]) ?>
This would give you the desired labels.
Upvotes: 1