/** * Constructor * * @param array $data */ public function __construct($data = array()) { if (!empty($data['settings'])) { foreach ((array) $data['settings'] as $name => $value) { $this->settings[$name] = $value; } unset($data['settings']); } parent::__construct($data); }
/** * String representation of object * * @link http://php.net/manual/en/serializable.serialize.php * @return string the string representation of the object or <b>null</b> */ public function serialize() { // Force to serialize the group & the role objects too $this->getGroup(); $this->getRoleId(); $this->getResourceId(); return parent::serialize(); }
/** * Delete should remove uploads directory too * * @return int */ public function delete() { static $publicDirs = array('uploads', 'thumbnails'); $success = parent::delete(); if ($success) { foreach ($publicDirs as $publicDir) { $this->removeDir(implode(DIRECTORY_SEPARATOR, array('.', 'public', $publicDir, $this->schema))); } } return $success; }