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

  • ActiveRecordCache
  • CollectDependenciesEvent
  • Connection
  • Connections
  • DateTimePropertySupport
  • Helpers
  • Hooks
  • Model
  • Models
  • Query
  • RunTimeActiveRecordCache
  • Statement
  • Table

Interfaces

  • ActiveRecordCacheInterface

Traits

  • CreatedAtProperty
  • DateTimeProperty
  • UpdatedAtProperty

Exceptions

  • ActiveRecordException
  • ConnectionAlreadyEstablished
  • ConnectionNotDefined
  • ConnectionNotEstablished
  • ModelAlreadyInstantiated
  • ModelNotDefined
  • RecordNotFound
  • ScopeNotDefined
  • StatementInvalid

Functions

  • get_model
 1 <?php
 2 
 3 /*
 4  * This file is part of the ICanBoogie 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 ICanBoogie\ActiveRecord;
13 
14 use ICanBoogie\Core;
15 
16 class Hooks
17 {
18     /**
19      * Synthesizes the `activerecord_connections` config from `activerecord` fragments.
20      *
21      * @param array $fragments
22      *
23      * @return array
24      */
25     static public function synthesize_connections_config(array $fragments)
26     {
27         $config = [];
28 
29         foreach ($fragments as $fragment)
30         {
31             if (empty($fragment['connections']))
32             {
33                 continue;
34             }
35 
36             $config = array_merge($config, $fragment['connections']);
37         }
38 
39         return $config;
40     }
41 
42     /*
43      * Prototypes
44      */
45 
46     /**
47      * Returns the connections accessor.
48      *
49      * @return ActiveRecord\Connections
50      */
51     static public function core_lazy_get_connections(Core $core)
52     {
53         return new Connections($core->configs['activerecord_connections'] ?: []);
54     }
55 
56     /**
57      * Getter for the "primary" database connection.
58      *
59      * @return Database
60      */
61     static public function core_lazy_get_db(Core $core)
62     {
63         return $core->connections['primary'];
64     }
65 
66     /**
67      * Returns the ActiveRecord cache associated with the model.
68      *
69      * @param Model $model
70      *
71      * @return \ICanBoogie\ActiveRecord\RuntimeCache
72      */
73     static public function model_lazy_get_activerecord_cache(Model $model)
74     {
75         return new RunTimeActiveRecordCache($model);
76     }
77 }
Autodoc API documentation generated by ApiGen 2.8.0