Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • DeleteBlock
  • DeleteOperation
  • EditBlock
  • Hooks
  • ManageBlock
  • Model
  • Module
  • PermissionsOperation
  • Role
  • SaveOperation
 1 <?php
 2 
 3 /*
 4  * This file is part of the Icybee package.
 5  *
 6  * (c) Olivier Laviale <olivier.laviale@gmail.com>
 7  *
 8  * For the full copyright and license information, please view the LICENSE
 9  * file that was distributed with this source code.
10  */
11 
12 namespace Icybee\Modules\Users\Roles;
13 
14 use ICanBoogie\Exception;
15 use ICanBoogie\I18n;
16 
17 /**
18  * Primary model of the Roles module (users.roles).
19  */
20 class Model extends \ICanBoogie\ActiveRecord\Model
21 {
22     /**
23      * If defined, the property {@link Role::PERMS} is serialized using the {@link json_encode()}
24      * function to set the property {@link Role::SERIALIZED_PERMS}.
25      */
26     public function save(array $properties, $key=null, array $options=array())
27     {
28         if (isset($properties[Role::PERMS]))
29         {
30             $properties[Role::SERIALIZED_PERMS] = json_encode($properties[Role::PERMS]);
31         }
32 
33         return parent::save($properties, $key, $options);
34     }
35 
36     /**
37      * @throws Exception when on tries to delete the role with identifier "1".
38      */
39     public function delete($rid)
40     {
41         if ($rid == 1)
42         {
43             throw new Exception('The role %role (%rid) cannot be deleted.', array('%role' => I18n\t('Visitor'), '%rid' => $rid));
44         }
45 
46         // FIXME-20110709: deleted role is not removed from users records.
47 
48         return parent::delete($rid);
49     }
50 }
51 
Autodoc API documentation generated by ApiGen 2.8.0