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 JSONEmbeddedModelFieldsBehavior

Behavior class for more advanced JSON storage in fields, using CModel children in protected/models/embedded for validation, input widget rendering, etc.

Supports multiple distinct stored structures of JSON (and also, with encryption), distinguished by a separate attribute in the model (specified by JSONEmbeddedModelFieldsBehavior::$templateAttr), and each field embedded within the JSON has its own special options (i.e. default values, specific input widgets, etc) defined in the model classes used.

CComponent
Extended by CBehavior implements IBehavior
Extended by CModelBehavior
Extended by CActiveRecordBehavior
Extended by TransformedFieldStorageBehavior
Extended by EncryptedFieldsBehavior
Extended by JSONEmbeddedModelFieldsBehavior
Package: application\components
Author: Demitri Morgan <demitri@x2engine.com>
Located at x2engine/protected/components/JSONEmbeddedModelFieldsBehavior.php
Methods summary
public
# attach( type $owner )

Before attaching, check whether checking for a proper encryption object and throwing an exception if there isn't one is actually necessary.

Before attaching, check whether checking for a proper encryption object and throwing an exception if there isn't one is actually necessary.

Parameters

$owner
type
$owner

Throws

Exception

Overrides

EncryptedFieldsBehavior::attach()
public JSONEmbeddedModel
# attributeModel( type $name, mixed $attributes = null )

Returns the model object for the named attribute

Returns the model object for the named attribute

Instantiates a new model for the field and saves it in a "cache" of embedded models for the active record object if necessary.

Parameters

$name
type
$name The name of the attribute.
$attributes

Returns

JSONEmbeddedModel
public
# beforeValidate( CModelEvent $event )

Performs validation on the embedded models, and instantiates/sets attributes of the embedded model if necessary.

Performs validation on the embedded models, and instantiates/sets attributes of the embedded model if necessary.

Parameters

$event
CModelEvent
$event event parameter

Overrides

CModelBehavior::beforeValidate()
public
# beforeSave( type $event )

Sets the encryption flag such that it accurately reflects the status of data going into the database.

Sets the encryption flag such that it accurately reflects the status of data going into the database.

Parameters

$event
type
$event

Overrides

TransformedFieldStorageBehavior::beforeSave()
public
# instantiateField( string $name )

Loads the embedded model into the owner's attribute and returns it

Loads the embedded model into the owner's attribute and returns it

Parameters

$name
string
$name Attribute corresponding to the model
public
# instantiateFields( )

Instantiates all fields. This method must be called if the active record model is new.

Instantiates all fields. This method must be called if the active record model is new.

public type
# packAttribute( type $name )

JSON-encodes (and optionally encrypts) the model's attributes for storage.

JSON-encodes (and optionally encrypts) the model's attributes for storage.

Parameters

$name
type
$name

Returns

type

Overrides

EncryptedFieldsBehavior::packAttribute()
public JSONEmbeddedModel
# unpackAttribute( string $name, boolean $new = false )

Restores the model. It will also instantiate the embedded model if it hasn't already been instantiated and "cache" it in JSONEmbeddedModelFieldsBehavior::$attrModels.

Restores the model. It will also instantiate the embedded model if it hasn't already been instantiated and "cache" it in JSONEmbeddedModelFieldsBehavior::$attrModels.

Parameters

$name
string
$name
$new
boolean
$new Instantiates and returns a new model rather than using existing data

Returns

JSONEmbeddedModel

Overrides

EncryptedFieldsBehavior::unpackAttribute()
Methods inherited from EncryptedFieldsBehavior
setup(), setupUnsafe()
Methods inherited from TransformedFieldStorageBehavior
afterFind(), afterSave(), packAll(), unpackAll()
Methods inherited from CActiveRecordBehavior
afterDelete(), beforeCount(), beforeDelete(), beforeFind(), events()
Methods inherited from CModelBehavior
afterConstruct(), afterValidate()
Methods inherited from CBehavior
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
protected boolean $hasOptions false
#

In this case, the structure of the embedded object will be defined in the model classes, so there's no need to define the fields in the declaration of transformAttr.

In this case, the structure of the embedded object will be defined in the model classes, so there's no need to define the fields in the declaration of transformAttr.

public type $attrModels array()
#

An array storing attribute models. Eliminates the need to re-instantiate during unpacking.

An array storing attribute models. Eliminates the need to re-instantiate during unpacking.

public boolean $checkObject false
#

If true, throws an exception if no object has been instantiated.

If true, throws an exception if no object has been instantiated.

This is to prevent generating a new key for every new usage (which would render useless any and all encrypted data; it could not be decrypted if that were the case).

public type $encryptedFlagAttr false
#

Attribute of the model class indicating whether the attribute(s) is/are encrypted. if set to false, encryption will be completely ignored.

Attribute of the model class indicating whether the attribute(s) is/are encrypted. if set to false, encryption will be completely ignored.

public array $fixedModelFields array()
#

An array of field name keys to model name values defining fields which will always use the same embedded model type.

An array of field name keys to model name values defining fields which will always use the same embedded model type.

public string|array $templateAttr
#

Specifies the name(s) of the attribute(s) of the model implementing this behavior to be used for determining the model class corresponding to the embedded model.

Specifies the name(s) of the attribute(s) of the model implementing this behavior to be used for determining the model class corresponding to the embedded model.

More than one model class can be specified by declaring this an array with model field names and names of field that specify the embedded model in those fields as the values, in which case every attribute declared in TransformedFieldStorageBehavior::$transformAttributes must be declared in the array.

Properties inherited from EncryptedFieldsBehavior
$encrypt, $encryption
Properties inherited from TransformedFieldStorageBehavior
$transformAttributes
Magic properties inherited from CActiveRecordBehavior
$owner
Magic properties inherited from CBehavior
$enabled
X2CRM Documentation API documentation generated by ApiGen 2.8.0