Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • None
  • system
    • base
    • caching
    • console
    • db
      • ar
      • schema
    • validators
    • web
      • actions
      • auth
      • helpers
      • widgets
        • captcha
        • pagers
  • zii
    • widgets
      • grid

Classes

  • AccountsGridViewProfileWidget
  • ActionMenu
  • ActionsGridViewProfileWidget
  • ActionsQuickCreateRelationshipBehavior
  • ActiveDateRangeInput
  • ApplicationConfigBehavior
  • Attachments
  • ChatBox
  • CommonControllerBehavior
  • ContactMapInlineTags
  • ContactsGridViewProfileWidget
  • CronForm
  • CSaveRelationsBehavior
  • DateRangeInputsWidget
  • DocsGridViewProfileWidget
  • DocViewer
  • DocViewerProfileWidget
  • EButtonColumnWithClearFilters
  • EmailDeliveryBehavior
  • EmailProgressControl
  • EncryptedFieldsBehavior
  • EventsChartProfileWidget
  • FileUploader
  • FontPickerInput
  • Formatter
  • FormView
  • GridViewWidget
  • History
  • IframeWidget
  • ImportExportBehavior
  • InlineActionForm
  • InlineEmailAction
  • InlineEmailForm
  • InlineEmailModelBehavior
  • InlineQuotes
  • JSONEmbeddedModelFieldsBehavior
  • JSONFieldsDefaultValuesBehavior
  • LeadRoutingBehavior
  • LeftWidget
  • LoginThemeHelper
  • LoginThemeHelperBase
  • MarketingGridViewProfileWidget
  • MediaBox
  • MessageBox
  • MobileFormatter
  • MobileFormLayoutRenderer
  • MobileLayoutRenderer
  • MobileLoginThemeHelper
  • MobileViewLayoutRenderer
  • ModelFileUploader
  • NewWebLeadsGridViewProfileWidget
  • NormalizedJSONFieldsBehavior
  • NoteBox
  • OnlineUsers
  • OpportunitiesGridViewProfileWidget
  • Panel
  • ProfileDashboardManager
  • ProfileGridViewWidget
  • ProfileLayoutEditor
  • ProfilesGridViewProfileWidget
  • Publisher
  • PublisherActionTab
  • PublisherCalendarEventTab
  • PublisherCallTab
  • PublisherCommentTab
  • PublisherEventTab
  • PublisherSmallCalendarEventTab
  • PublisherTab
  • PublisherTimeTab
  • QuickContact
  • QuickCreateRelationshipBehavior
  • QuotesGridViewProfileWidget
  • RecordAliasesWidget
  • RecordViewLayoutManager
  • RecordViewWidgetManager
  • RememberPagination
  • Reminders
  • ResponseBehavior
  • ResponsiveHtml
  • SearchIndexBehavior
  • ServicesGridViewProfileWidget
  • SmallCalendar
  • SmartActiveDataProvider
  • SmartDataProviderBehavior
  • SmartSort
  • SocialForm
  • SortableWidgetManager
  • SortableWidgets
  • TagBehavior
  • TagCloud
  • TemplatesGridViewProfileWidget
  • TimeZone
  • TopContacts
  • TopSites
  • TransformedFieldStorageBehavior
  • TranslationLogger
  • TwitterFeed
  • TwoColumnSortableWidgetManager
  • UpdaterBehavior
  • UpdatesForm
  • UserIdentity
  • UsersChartProfileWidget
  • WorkflowBehavior
  • X2ActiveGridView
  • X2ActiveGridViewForSortableWidgets
  • X2AssetManager
  • X2AuthManager
  • X2ChangeLogBehavior
  • X2ClientScript
  • X2Color
  • X2DateUtil
  • X2FixtureManager
  • X2FlowFormatter
  • X2GridView
  • X2GridViewBase
  • X2GridViewForSortableWidgets
  • X2GridViewSortableWidgetsBehavior
  • X2LeadsGridViewProfileWidget
  • X2LinkableBehavior
  • X2ListView
  • X2PillBox
  • X2ProgressBar
  • X2SmartSearchModelBehavior
  • X2TimestampBehavior
  • X2TranslationBehavior
  • X2UrlRule
  • X2WebModule
  • X2Widget
  • X2WidgetList
  • Overview
  • Package
  • Class
  • Tree

Class TransformedFieldStorageBehavior

Base class for behaviors which store attributes in a different form than when the model and its attributes are loaded.

Its purpose is to be used in cases whenever the stored value in the database will be different in some way from the value of the attribute when it is loaded in the model. For example, storing a JSON string in a database record, and having the corresponding model attribute be the decoded JSON object as an associative array. Thus, the transformation is transparent and requires no extra action in the code where the model is being used.

In all child classes, methods TransformedFieldStorageBehavior::unpackAttribute() and TransformedFieldStorageBehavior::packAttribute() must be inverses of each other. In other words, given a value X, the value returned by unpackAttribute(packAttribute(X)) should be identical to X. This ensures that the storage of the data does not modify the data, one critical requirement of all database-driven software. Exceptions can be made only if any loss or addition of data is intentional and stops after a certain number of iterations of packing and unpacking.

CComponent
Extended by CBehavior implements IBehavior
Extended by CModelBehavior
Extended by CActiveRecordBehavior
Extended by TransformedFieldStorageBehavior

Direct known subclasses

EncryptedFieldsBehavior, JSONFieldsBehavior

Indirect known subclasses

JSONEmbeddedModelFieldsBehavior, JSONFieldsDefaultValuesBehavior, NormalizedJSONFieldsBehavior
Abstract
Package: application\components
Author: Demitri Morgan <demitri@x2engine.com>
Located at x2engine/protected/components/TransformedFieldStorageBehavior.php
Methods summary
abstract public
# packAttribute( mixed $name )

In child classes, this method takes the "working"/"unpacked" value of the attribute, and returns the value that is to be stored in the database.

In child classes, this method takes the "working"/"unpacked" value of the attribute, and returns the value that is to be stored in the database.

abstract public
# unpackAttribute( mixed $name )

In child classes, this method returns the "working" value, after retrieval from the database.

In child classes, this method returns the "working" value, after retrieval from the database.

public
# packAll( )

Prepares all attributes for storage

Prepares all attributes for storage

public
# unpackAll( )

Prepares all attributes for usage in the code, after database interaction

Prepares all attributes for usage in the code, after database interaction

public
# beforeSave( CModelEvent $event )

Responds to CActiveRecord::onBeforeSave event. Override this method and make it public if you want to handle the corresponding event of the CBehavior::owner owner. You may set CModelEvent::isValid to be false to quit the saving process.

Responds to CActiveRecord::onBeforeSave event. Override this method and make it public if you want to handle the corresponding event of the CBehavior::owner owner. You may set CModelEvent::isValid to be false to quit the saving process.

Parameters

$event
CModelEvent
$event event parameter

Overrides

CActiveRecordBehavior::beforeSave()
public
# afterSave( CEvent $event )

Responds to CActiveRecord::onAfterSave event. Override this method and make it public if you want to handle the corresponding event of the CBehavior::owner owner.

Responds to CActiveRecord::onAfterSave event. Override this method and make it public if you want to handle the corresponding event of the CBehavior::owner owner.

Parameters

$event
CEvent
$event event parameter

Overrides

CActiveRecordBehavior::afterSave()
public
# afterFind( CEvent $event )

Responds to CActiveRecord::onAfterFind event. Override this method and make it public if you want to handle the corresponding event of the CBehavior::owner owner.

Responds to CActiveRecord::onAfterFind event. Override this method and make it public if you want to handle the corresponding event of the CBehavior::owner owner.

Parameters

$event
CEvent
$event event parameter

Overrides

CActiveRecordBehavior::afterFind()
Methods inherited from CActiveRecordBehavior
afterDelete(), beforeCount(), beforeDelete(), beforeFind(), events()
Methods inherited from CModelBehavior
afterConstruct(), afterValidate(), beforeValidate()
Methods inherited from CBehavior
attach(), detach(), getEnabled(), getOwner(), setEnabled()
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Properties summary
public array $transformAttributes array()
#

Array of attributes to transform.

Array of attributes to transform.

protected type $hasOptions false
#

If true, specifies that the array TransformedFieldStorageBehavior::$transformAttributes has keys that refer to the attribute names and values referring to options for each attribute. Otherwise, it is a simple array containing attribute names.

If true, specifies that the array TransformedFieldStorageBehavior::$transformAttributes has keys that refer to the attribute names and values referring to options for each attribute. Otherwise, it is a simple array containing attribute names.

Magic properties inherited from CActiveRecordBehavior
$owner
Magic properties inherited from CBehavior
$enabled
X2CRM Documentation API documentation generated by ApiGen 2.8.0