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

  • AdjustNode
  • ConfigOperation
  • DeleteBlock
  • DeleteOperation
  • EditBlock
  • ExportBlock
  • ExportOperation
  • Helpers
  • Hooks
  • ImportOperation
  • ManageBlock
  • Model
  • Module
  • Node
  • OfflineOperation
  • OnlineOperation
  • PopNode
  • QueryOperationOperation
  • SaveOperation
  • TitleSlugCombo
  • Update20131208
  • Update20140405
  • ViewProvider

Functions

  • slugize
 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\Nodes;
13 
14 use ICanBoogie\Updater\Update;
15 
16 /**
17  * - Renames the `created` columns as `created_as`.
18  * - Renames the `modified` columns as `updated_as`.
19  *
20  * @module nodes
21  */
22 class Update20131208 extends Update
23 {
24     public function update_column_created_at()
25     {
26         $this->module->model
27         ->assert_has_column('created')
28         ->rename_column('created', 'created_at');
29     }
30 
31     public function update_column_updated_at()
32     {
33         $this->module->model
34         ->assert_has_column('modified')
35         ->create_column('updated_at');
36     }
37 }
38 
39 /**
40  * Adds the `uuid` column.
41  *
42  * @module nodes
43  */
44 class Update20140405 extends Update
45 {
46     public function update_column_uuid()
47     {
48         $this->module->model
49         ->assert_not_has_column('uuid')
50         ->create_column('uuid');
51 
52         #
53         # Update records with UUID values.
54         #
55 
56         $target = $this->module->model->target;
57         $tokens = $target->select('nid, NULL')->pairs;
58 
59         foreach (array_keys($tokens) as $nid)
60         {
61             for (;;)
62             {
63                 $token = \ICanBoogie\generate_v4_uuid();
64 
65                 if (!in_array($token, $tokens))
66                 {
67                     break;
68                 }
69             }
70 
71             $tokens[$nid] = $token;
72         }
73 
74         $update = $target->prepare("UPDATE `{self}` SET `uuid` = ? WHERE `nid` = ?");
75 
76         foreach ($tokens as $nid => $token)
77         {
78             $update($token, $nid);
79         }
80 
81         #
82         # Create index.
83         #
84 
85         $this->module->model->create_unique_index('uuid');
86     }
87 }
Autodoc API documentation generated by ApiGen 2.8.0