Class BEAppModel
-
Model
-
AppModel
-
BEAppModel
Direct known subclasses
Alias
,
Annotation
,
DateItem
,
EventLog
,
GeoTag
,
Group
,
HashJob
,
History
,
LangText
,
MailGroup
,
MailGroupCard
,
MailJob
,
BannedIp
,
MailLog
,
Module
,
ObjectEditor
,
ObjectProperty
,
ObjectRelation
,
ObjectType
,
ObjectUser
,
Permission
,
PermissionModule
,
Product
,
BEAppObjectModel
,
Property
,
PropertyOption
,
RestClientModel
,
SearchText
,
SectionDummy
,
SoapClientModel
,
Stream
,
Tree
,
User
,
UserProperty
,
BeditaExportFilter
,
Version
,
BeditaImportFilter
,
BEObject
,
Category
,
Content
,
DataTransfer
Indirect known subclasses
Application
,
Area
,
BeditaStreamModel
,
BEFile
,
Card
,
CardsImportFilter
,
Comment
,
Document
,
EditorNote
,
Event
,
Gallery
,
Image
,
Audio
,
JsonExportFilter
,
JsonImportFilter
,
Link
,
MailMessage
,
MailTemplate
,
Section
,
ShortNews
,
Video
,
XmlExportFilter
,
XmlImportFilter
,
BeditaAnnotationModel
,
BeditaCollectionModel
,
BeditaContentModel
,
BeditaObjectModel
,
BeditaProductModel
,
BeditaSimpleObjectModel
,
BeditaSimpleStreamModel
Methods summary
public
array
|
#
am( array $record, array $skipKeys = array() )
Merge record result array to top level, skipping specified keys.
Merge record result array to top level, skipping specified keys.
Parameters
- $record
- Record data.
- $skipKeys
- Keys to be skipped even if their value is an array.
Returns
array Record merged to single array.
|
protected
|
|
public
|
|
public
|
|
public
|
|
public
unknown
|
#
getDefaultDateFormat( unknown_type $value = null, $throwOnError = false )
Get SQL date format
Parameters
Returns
unknown
|
protected
|
#
checkDate( string $key, boolean $throwOnError = false )
Check date field in $this->data[ModelName][$key] -> set to null if empty or call getDefaultDateFormat
Check date field in $this->data[ModelName][$key] -> set to null if empty or call getDefaultDateFormat
Parameters
- $key
- $throwOnError
- $throwOnError, throw exception on error, default false
|
protected
|
#
checkFloat( string $key )
Check float/double field in $this->data[ModelName][$key] -> set to null if empty
Check float/double field in $this->data[ModelName][$key] -> set to null if empty
Parameters
|
protected
|
#
checkNumber( string $key )
Check integer/generic number in $this->data[ModelName][$key] -> set to null if empty
Check integer/generic number in $this->data[ModelName][$key] -> set to null if empty
Parameters
|
protected
|
#
checkDuration( string $key )
Check duration format in $this->data[ModelName][$key] -> set to null if empty/invalid.
Check duration format in $this->data[ModelName][$key] -> set to null if empty/invalid.
Parameters
|
public
array
|
#
toolbar( integer $page, integer $dimPage, integer $size )
Object search Toolbar
Parameters
- $page
- $dimPage
- page dimension (limit sql)
- $size
- count of all records
Returns
array for pagination
"first" => first page; if there is only one page its value is 0 else 1
"prev" => previous page; 0 if there isn't previous page
"next" => next page; 0 if there isn't next page
"last" => last page; 0 if it's the last page
"size" => number of all records
"pages" => total number of pages
"page" => number of current page
"dim" => number of records per page
"start" => number of the record with which the page begins counting from the first page
"end" => number of the record with which the page ends counting from the first page
|
protected
string
|
#
getLimitClausole( integer $dim, integer $page = 1 )
SQL limit clausole
Parameters
- $dim
- $dim, global size/count
- $page
- $page, page num
Returns
string
|
public
|
|
public
array|false
|
#
getBindingsLevel( string $level = null )
Return self::modelBindings level
Return self::modelBindings level
Parameters
- $level
- define the level to return. Leave empty to return all bindings level
Returns
array|false return false if $level is not set
|
public
|
#
setBindingsLevel( string $level, array $bindings = array() )
Set self::modelBindings level
Set self::modelBindings level
Parameters
- $level
- the level name
- $bindings
- array of model bindings
|
public
|
#
fieldsString( $modelName, $alias = null, $excludeFields = array() )
|
public
|
#
findObjects( integer $id = null, string $userid = null, string $status = null, array $filter = array(), string $order = null, boolean $dir = true, integer $page = 1, integer $dim = null, boolean $all = false, array $excludeIds = array() )
perform an objects search
perform an objects search
Parameters
- $id
- root id, if it's set perform search on the tree
- $userid
- user: null (default) => no permission check. ' ' => guest/anonymous user,
- $status
- object status
- $filter
example of filter:
parent_id => used if $id is empty as root id
"object_type_id" => array(21,22,...),
"ModelName.fieldname => "value",
"query" => "text to search"
....
reserved filter words:
"category" => "val" search by category id or category name
"relation" => "val" search by object_relations swicth
"rel_object_id" => "val" search object relateds to a particular object (object_relation object_id)
...
see all in BuildFilter behavior
"afterFilter" => array() define some operations executed after the objects search
to spec on array params see BEAppModel::findObjectsAfterFilter()
- $order
- field to order result (id, status, modified..)
- $dir
- true (default), ascending, otherwise descending.
- $page
- Page number (for pagination)
- $dim
- Page dim (for pagination). Default get all
- $all
- true: all tree levels (discendents), false: only first level (children)
- $excludeIds
- Array of id's to exclude
|
public
integer|string
|
#
findObjectsCount( array $clauses, boolean $executeQuery = true )
Return an objects count
The count can be customized using $clauses as in self::buildQueryStatement
Keys fields , table and alias defined in $clauses will be overridden.
Other keys have to take account that objects table is aliased with BEObject
Setting executeQuery to false will return the SQL query as string
Parameters
- $clauses
- The sql clauses
- $executeQuery
- If the query have to executed or returned
Returns
integer|string
|
public
array
|
#
findObjectsClauses( array $options )
Return an array of query clauses starting from some options
and applying some filters.
Return an array of query clauses starting from some options
and applying some filters.
Possible options are the arguments passed to self::findObjects()
Parameters
- $options
- An array of options
Returns
array
See
self::findObjects() to see the meaning of $options keys
BuildFilterBehavior to see how to the filter is used to build the query clauses
|
public
string
|
#
buildQueryStatement( array $clauses )
Given an array of clauses build a SQL SELECT query
Given an array of clauses build a SQL SELECT query
Parameters
Returns
string
|
protected
|
#
findObjectsAfterFilter( array & $items, array $params )
callback called by BEAppModel::findObjects() to work on list of BEdita objects
callback called by BEAppModel::findObjects() to work on list of BEdita objects
Parameters
- $items
- list of BEdita objects filtered by BEAppModel::findObjects()
- $params
it's an array of configurable parameters to launch callbacks on Models or Behaviors.
Every callback has to return the array of BEdita objects passed to it.
It can be a plain array:
array(
'type' => 'Model' or 'Behavior' default to 'Model'
'className' => 'ClassName' for Behavior it's the class name without Behavior suffix
'methodName' => 'methodName' the method name of ClassName
'options' => array() array of options to pass to ClassName::methodName()
)
or it can be a multidimensional array, for example
array(
array(
'type' => 'Model',
'className' => 'ModelClassName',
'methodName' => 'modelMethodName',
'options' => array()
),
array(
'type' => 'Behavior',
'className' => 'BehaviorClassName',
'methodName' => 'behaviorMethodName',
'options' => array()
)
)
If type is 'Model' the 'modelMethodName' method of 'ModelClassName' should be defined as
public function modelMethodName($items, $options) {
....
return $items;
}
If type is 'Behavior' the 'behaviorMethodName' method 'BehaviorClassName' should be defined as
public function behaviorMethodName(&$model, $items, $options) {
....
return $items;
}
|