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\DateTime;
15 
16 /**
17  * Provides support for datetime properties.
18  */
19 class DateTimePropertySupport
20 {
21     /**
22      * Sets the a datetime is a property.
23      *
24      * @param mixed $property Reference to the property to set.
25      * @param mixed $datetime Date and time.
26      */
27     static public function datetime_set(&$property, $datetime)
28     {
29         $property = $datetime;
30     }
31 
32     /**
33      * Returns the {@link DateTime} instance of a property.
34      *
35      * @param mixed $property Reference to the property to return.
36      *
37      * @return DateTime The function always return a {@link DateTime} instance.
38      */
39     static public function datetime_get(&$property)
40     {
41         if ($property instanceof DateTime)
42         {
43             return $property;
44         }
45 
46         return $property = $property === null ? DateTime::none() : new DateTime($property, 'utc');
47     }
48 }
49 
50 /**
51  * Implements a `datetime` property.
52  */
53 trait DateTimeProperty
54 {
55     /**
56      * The date and time at which the record was created.
57      *
58      * @var string
59      */
60     private $datetime;
61 
62     /**
63      * Returns the date and time at which the record was created.
64      *
65      * @return \ICanBoogie\DateTime
66      */
67     protected function get_datetime()
68     {
69         return DateTimePropertySupport::datetime_get($this->datetime);
70     }
71 
72     /**
73      * Sets the date and time at which the record was created.
74      *
75      * @param mixed $value
76      */
77     protected function set_datetime($datetime)
78     {
79         DateTimePropertySupport::datetime_set($this->datetime, $datetime);
80     }
81 }
Autodoc API documentation generated by ApiGen 2.8.0