/** * @copydoc AppModel::afterFind() * * after getting the data split the model into its plugin / model parts * for the ajax selects to work properly */ public function afterFind($results, $primary = false) { parent::afterFind($results, $primary); if (isset($results[0][$this->alias]['model'])) { foreach ($results as $k => $result) { $parts = pluginSplit($results[$k][$this->alias]['model']); $results[$k][$this->alias]['model_class'] = $results[$k][$this->alias]['model']; $results[$k][$this->alias]['plugin'] = $parts[0]; $results[$k][$this->alias]['model'] = $parts[1]; } } return $results; }
public function __construct($id = false, $table = null, $ds = null) { parent::__construct($id, $table, $ds); $this->validate = array('title' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter a name for this content item'))), 'layout_id' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please select the layout for this content item'))), 'body' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter the body of this content item')))); }
public function __construct($id = false, $table = null, $ds = null) { parent::__construct($id, $table, $ds); $this->_schema = array('file_name' => array('type' => 'string', 'null' => false, 'default' => null, 'key' => 'primary'), 'slug' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 255), 'name' => array('type' => 'string', 'null' => false, 'default' => null, 'key' => 'unique'), 'body' => array('type' => 'text', 'null' => false, 'default' => '', 'length' => null)); $this->validate = array('file_name' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __d('contents', 'Please enter a filename for this item')), 'isUnique' => array('rule' => 'isUnique', 'message' => __d('contents', 'The page name must be unique'), 'on' => 'create'), 'validFileName' => array('rule' => '/^[A-Za-z0-9_]*\\.ctp$/', 'message' => __d('contents', 'The filename can only be alphanumeric or _ (underscore)'))), 'body' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __d('contents', 'The page can not be empty')))); }
public function __construct($id = false, $table = null, $ds = null) { parent::__construct($id, $table, $ds); $this->validate = array('name' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter a tag'))), 'keyname' => array('rule' => 'notEmpty', 'message' => __('Please enter the key name'))); }
public function afterSave($created) { $this->saveField('path_depth', count($this->getPath($this->id)) - 1, array('callbacks' => false)); return parent::afterSave($created); }