I used bake to make cms of the settings table.
It contains three fields.
Column Type Null Default
id int(11) No
key varchar(10) No
value varchar(200) No
And it have 3 records.
All create functionality is working fine. But delete and edit would only edit/delete the first record.
For getting link...
I used the following code in view file.
foreach ($languages as $language){ echo $this->Html->link(__('Edit'), array('action' => 'edit', $language['Language']['id'])); ?> echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $language['Language']['id']), null, __('Are you sure you want to delete # %s?', $language['Language']['id'])); }
I assigned following value to languages variable from controller.
$this->Language->recursive = 0; $this->set('languages', $this->paginate());
Schema:
CREATE TABLE IF NOT EXISTS languages (
id int(11) NOT NULL AUTO_INCREMENT,
title varchar(30) NOT NULL,
slug enum('eng','rus') NOT NULL DEFAULT 'eng',
symbol varchar(50) NOT NULL,
status enum('A','I','D') NOT NULL DEFAULT 'A',
created_dt timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
modified_dt datetime NOT NULL, PRIMARY KEY (id),
UNIQUE KEY Unique Language code (slug),
KEY status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;
in your controller do the following