Class Core_ORM
Object-relational mapping. Implement an Active record pattern.
Creating objects
// Create an empty object of model Book_Model $object = Core_ORM::factory('Book');
// Create an object of model Book_Model and load from database where primary key is 1 $object = Core_ORM::factory('Book', 1);
Set property, the first way:
$object->value(123)->otherValue('my value');
The second way:
$object->value = 123; $object->otherValue = 'my value';
Saving object
// Change column and save $object = Core_ORM::factory('Book', 1); $object ->value(123) ->save();
Finding objects
// Find all objects of model Book_Model $aBooks = Core_ORM::factory('Book')->findAll(); foreach ($aBooks as $oBook) { // do something }
// Find objects of model Book_Model with conditions $object = Core_ORM::factory('Book'); $object->queryBuilder() ->where('value', '=', 99); $aBooks = $object->findAll(); foreach ($aBooks as $oBook) { // do something }
Direct known subclasses
Indirect known subclasses
Admin_Form_Action_Model
,
Admin_Form_Field_Model
,
Advertisement_Group_Model
,
Directory_Phone_Type_Model
,
Directory_Social_Model
,
Directory_Social_Type_Model
,
Directory_Website_Model
,
Document_Dir_Model
,
Document_Model
,
Document_Status_Model
,
Document_Version_Model
,
Event_Attachment_Model
,
Event_Group_Model
,
Advertisement_Model
,
Event_Model
,
Event_Note_Model
,
Event_Siteuser_Model
,
Event_Status_Model
,
Event_Type_Model
,
Event_User_Model
,
Field_Dir_Model
,
Field_Entity
,
Field_Model
,
Field_Value_Datetime_Model
,
Advertisement_Show_Model
,
Field_Value_File_Model
,
Field_Value_Float_Model
,
Field_Value_Int_Model
,
Field_Value_String_Model
,
Field_Value_Text_Model
,
Filemanager_File
,
Form_Field_Dir_Model
,
Form_Field_Model
,
Form_Fill_Field_Model
,
Form_Fill_Model
,
Advertisement_Statistic_Model
,
Form_Lead_Conformity_Model
,
Form_Model
,
Form_Status_Model
,
Forum_Category_Model
,
Forum_Category_Siteuser_Group_Model
,
Forum_Group_Model
,
Forum_Model
,
Forum_Siteuser_Count_Model
,
Forum_Topic_Model
,
Forum_Topic_Post_Model
,
Affiliate_Plan_Level_Model
,
Forum_Topic_Subscriber_Model
,
Forum_Topic_View_Model
,
Helpdesk_Account_Model
,
Helpdesk_Attachment_Model
,
Helpdesk_Category_Model
,
Helpdesk_Criticality_Level_Model
,
Helpdesk_Holiday_Model
,
Helpdesk_Message_Filter_Condition_Model
,
Helpdesk_Message_Filter_Model
,
Helpdesk_Message_Model
,
Affiliate_Plan_Model
,
Helpdesk_Model
,
Helpdesk_Responsible_User_Model
,
Helpdesk_Search_Entity
,
Helpdesk_Standart_Answer_Dir_Model
,
Helpdesk_Standart_Answer_Model
,
Helpdesk_Standart_Answer_Word_Model
,
Helpdesk_Status_Model
,
Helpdesk_Ticket_Flag_Model
,
Helpdesk_Ticket_Model
,
Helpdesk_User_Letter_Template_Model
,
Antispam_Country_Language_Model
,
Helpdesk_User_Model
,
Helpdesk_Working_Hour_Entity
,
Helpdesk_Working_Hour_Model
,
Informationsystem_Comment_Property_Dir_Model
,
Informationsystem_Comment_Property_List_Model
,
Informationsystem_Comment_Property_Model
,
Informationsystem_Dir_Model
,
Informationsystem_Group_Model
,
Informationsystem_Group_Property_Dir_Model
,
Informationsystem_Group_Property_List_Model
,
Antispam_Country_Model
,
Informationsystem_Group_Property_Model
,
Informationsystem_Item_Comment_Model
,
Informationsystem_Item_Model
,
Informationsystem_Item_Property_Dir_Model
,
Informationsystem_Item_Property_List_Model
,
Informationsystem_Item_Property_Model
,
Informationsystem_Model
,
Ipaddress_Model
,
Lead_Directory_Address_Model
,
Lead_Directory_Email_Model
,
Antispam_Domain_Model
,
Lead_Directory_Phone_Model
,
Lead_Directory_Website_Model
,
Lead_Event_Model
,
Lead_Maturity_Model
,
Lead_Model
,
Lead_Need_Model
,
Lead_Note_Model
,
Lead_Shop_Item_Model
,
Lead_Status_Model
,
Lead_Step_Model
,
Antispam_Log_Model
,
Lib_Dir_Model
,
Lib_Model
,
Lib_Property_List_Value_Model
,
Lib_Property_Model
,
List_Dir_Model
,
List_Item_Model
,
List_Model
,
Maillist_Fascicle_File_Model
,
Maillist_Fascicle_Log_Model
,
Maillist_Fascicle_Model
,
Admin_Form_Model
,
Antispam_Stopword_Model
,
Maillist_Model
,
Maillist_Siteuser_Group_Model
,
Maillist_Siteuser_Model
,
Maillist_Siteuser_Siteuser_Group_Model
,
Maillist_Siteuser_Siteuser_Model
,
Maillist_Unsubscribe_Reason_Model
,
Maillist_Unsubscriber_Model
,
Message_Model
,
Message_Topic_Model
,
Messenger_Model
,
Backup_File
,
Messenger_User_Model
,
Module_Model
,
Notification_Model
,
Notification_Subscriber_Model
,
Notification_User_Model
,
Poll_Group_Model
,
Poll_Model
,
Poll_Response_Model
,
Poll_Vote_Model
,
Printlayout_Dir_Model
,
Benchmark_Model
,
Printlayout_Driver_Model
,
Printlayout_Model
,
Printlayout_Module_Model
,
Property_Dir_Model
,
Property_Model
,
Property_Value_Datetime_Model
,
Property_Value_File_Model
,
Property_Value_Float_Model
,
Property_Value_Int_Model
,
Property_Value_String_Model
,
Benchmark_Url_Model
,
Property_Value_Text_Model
,
Restapi_Token_Model
,
Revision_Entity
,
Revision_Model
,
Schedule_Model
,
Search_Log_Model
,
Search_Page_Model
,
Search_Page_Siteuser_Group_Model
,
Search_Word_Model
,
Seo_Driver_Model
,
Bot_Dir_Model
,
Seo_Indexed_Model
,
Seo_Link_Model
,
Seo_Page_Model
,
Seo_Query_Model
,
Seo_Rating_Model
,
Seo_Site_Model
,
Shop_Affiliate_Plan_Model
,
Shop_Bonus_Model
,
Shop_Cart_Model
,
Shop_Codetype_Model
,
Bot_Entity_Model
,
Shop_Comment_Property_Dir_Model
,
Shop_Comment_Property_List_Model
,
Shop_Comment_Property_Model
,
Shop_Company_Model
,
Shop_Compare_Model
,
Shop_Country_Location_City_Area_Model
,
Shop_Country_Location_City_Model
,
Shop_Country_Location_Model
,
Shop_Country_Model
,
Shop_Currency_Model
,
Bot_Model
,
Shop_Delivery_Condition_Dir_Model
,
Shop_Delivery_Condition_Model
,
Shop_Delivery_Model
,
Shop_Delivery_Payment_System_Model
,
Shop_Dir_Model
,
Shop_Discount_Model
,
Shop_Discountcard_Bonus_Model
,
Shop_Discountcard_Bonus_Type_Model
,
Shop_Discountcard_Level_Model
,
Shop_Discountcard_Model
,
Bot_Module_Model
,
Shop_Favorite_Model
,
Shop_Filter_Seo_Dir_Model
,
Shop_Filter_Seo_Model
,
Shop_Filter_Seo_Property_Model
,
Shop_Group_Model
,
Shop_Group_Property_Dir_Model
,
Shop_Group_Property_List_Model
,
Shop_Group_Property_Model
,
Shop_Item_Associated_Model
,
Shop_Item_Barcode_Model
,
Cache_Item_Entity
,
Shop_Item_Bonus_Model
,
Shop_Item_Certificate_Model
,
Shop_Item_Comment_Model
,
Shop_Item_Delivery_Option_Model
,
Shop_Item_Digital_Model
,
Shop_Item_Discount_Model
,
Shop_Item_Model
,
Shop_Item_Price_Model
,
Shop_Item_Property_Dir_Model
,
Shop_Item_Property_For_Group_Model
,
Cache_Tag_Model
,
Shop_Item_Property_Group_Dir_Model
,
Shop_Item_Property_Group_Model
,
Shop_Item_Property_List_Model
,
Shop_Item_Property_Model
,
Shop_Item_Reserved_Model
,
Shop_Item_Set_Model
,
Shop_Measure_Model
,
Shop_Model
,
Shop_Order_History_Model
,
Shop_Order_Item_Code_Model
,
Admin_Form_Setting_Model
,
Calendar_Caldav_Model
,
Shop_Order_Item_Digital_Model
,
Shop_Order_Item_Model
,
Shop_Order_Item_Status_Model
,
Shop_Order_Model
,
Shop_Order_Property_Dir_Model
,
Shop_Order_Property_List_Model
,
Shop_Order_Property_Model
,
Shop_Order_Status_Model
,
Shop_Payment_System_Model
,
Shop_Price_Entry_Model
,
Calendar_Caldav_User_Model
,
Shop_Price_Model
,
Shop_Price_Setting_Item_Model
,
Shop_Price_Setting_Model
,
Shop_Print_Form_Model
,
Shop_Producer_Dir_Model
,
Shop_Producer_Model
,
Shop_Purchase_Discount_Coupon_Model
,
Shop_Purchase_Discount_Model
,
Shop_Seller_Model
,
Shop_Siteuser_Transaction_Model
,
Cdn_Model
,
Shop_Specialprice_Model
,
Shop_Tab_Dir_Model
,
Shop_Tab_Group_Model
,
Shop_Tab_Item_Model
,
Shop_Tab_Model
,
Shop_Tab_Producer_Model
,
Shop_Tax_Model
,
Shop_Warehouse_Cell_Item_Model
,
Shop_Warehouse_Cell_Model
,
Shop_Warehouse_Entry_Accumulate_Model
,
Cdn_Site_Model
,
Shop_Warehouse_Entry_Model
,
Shop_Warehouse_Incoming_Item_Model
,
Shop_Warehouse_Incoming_Model
,
Shop_Warehouse_Inventory_Item_Model
,
Shop_Warehouse_Inventory_Model
,
Shop_Warehouse_Item_Model
,
Shop_Warehouse_Model
,
Shop_Warehouse_Movement_Item_Model
,
Shop_Warehouse_Movement_Model
,
Shop_Warehouse_Regrade_Item_Model
,
Cloud_Dir
,
Shop_Warehouse_Regrade_Model
,
Shop_Warehouse_Type_Model
,
Shop_Warehouse_Writeoff_Item_Model
,
Shop_Warehouse_Writeoff_Model
,
Shortcode_Dir_Model
,
Shortcode_Model
,
Shortlink_Dir_Model
,
Shortlink_Model
,
Site_Alias_Model
,
Site_Model
,
Cloud_File
,
Siteuser_Affiliate_Model
,
Siteuser_Company_Directory_Address_Model
,
Siteuser_Company_Directory_Email_Model
,
Siteuser_Company_Directory_Messenger_Model
,
Siteuser_Company_Directory_Phone_Model
,
Siteuser_Company_Directory_Social_Model
,
Siteuser_Company_Directory_Website_Model
,
Siteuser_Company_Model
,
Siteuser_Email_Attachment_Model
,
Siteuser_Email_Model
,
Cloud_Model
,
Siteuser_Group_List_Model
,
Siteuser_Group_Model
,
Siteuser_Group_Siteuser_Model
,
Siteuser_Identity_Model
,
Siteuser_Identity_Provider_Model
,
Siteuser_Model
,
Siteuser_Person_Directory_Email_Model
,
Siteuser_Person_Directory_Messenger_Model
,
Siteuser_Person_Directory_Phone_Model
,
Siteuser_Person_Directory_Social_Model
,
Comment_Informationsystem_Item_Model
,
Siteuser_Person_Directory_Website_Model
,
Siteuser_Person_Model
,
Siteuser_Property_Dir_Model
,
Siteuser_Property_List_Model
,
Siteuser_Property_Model
,
Siteuser_Relationship_Model
,
Siteuser_Relationship_Type_Model
,
Siteuser_Shop_Cart_Model
,
Siteuser_Source_Model
,
Siteuser_Status_Model
,
Comment_Model
,
Siteuser_Type_Model
,
Siteuser_User_Model
,
Source_Model
,
Structure_Menu_Model
,
Structure_Model
,
Structure_Property_Dir_Model
,
Structure_Property_List_Model
,
Structure_Property_Model
,
Tag_Dir_Model
,
Tag_Informationsystem_Item_Model
,
Comment_Shop_Item_Model
,
Tag_Model
,
Tag_Shop_Item_Model
,
Template_Dir_Model
,
Template_Model
,
Template_Section_Lib_Model
,
Template_Section_Model
,
Tpl_Dir_Model
,
Tpl_Model
,
Trash_Entity
,
Update_Entity
,
Admin_Language_Model
,
Company_Activity_Model
,
Update_Module_Entity
,
User_Absence_Model
,
User_Absence_Type_Model
,
User_Accessdenied_Model
,
User_Bookmark_Model
,
User_Directory_Email_Model
,
User_Directory_Messenger_Model
,
User_Directory_Phone_Model
,
User_Directory_Social_Model
,
User_Directory_Website_Model
,
Company_Department_Action_Access_Model
,
User_Message_Model
,
User_Model
,
User_Note_Model
,
User_Session_Model
,
User_Setting_Model
,
User_Wallpaper_Model
,
User_Workday_Break_Model
,
User_Workday_Model
,
User_Worktime_Model
,
Vote_Comment_Model
,
Company_Department_Directory_Email_Model
,
Vote_Informationsystem_Item_Model
,
Vote_Model
,
Vote_Shop_Item_Model
,
Wysiwyg_Filemanager_File
,
Xsl_Dir_Model
,
Xsl_Model
,
Company_Department_Directory_Phone_Model
,
Company_Department_Model
,
Company_Department_Module_Model
,
Company_Department_Post_User_Model
,
Company_Department_Site_Form_Action_Model
,
Company_Department_Site_Form_Model
,
Company_Department_Site_Module_Model
,
Admin_Word_Model
,
Company_Directory_Address_Model
,
Company_Directory_Email_Model
,
Company_Directory_Phone_Model
,
Company_Directory_Website_Model
,
Company_Location_Model
,
Company_Model
,
Company_Post_Model
,
Company_Site_Model
,
Compression_Css_Model
,
Constant_Dir_Model
,
Admin_Word_Value_Model
,
Constant_Model
,
Counter_Browser_Model
,
Counter_Counter_Model
,
Counter_Device_Model
,
Counter_Display_Model
,
Counter_Entity
,
Counter_Model
,
Counter_Os_Model
,
Counter_Page_Model
,
Counter_Referrer_Model
,
Advertisement_Contextualword_Model
,
Counter_Searchquery_Model
,
Counter_Session_Model
,
Counter_Useragent_Model
,
Counter_Visit_Model
,
Crm_Project_Model
,
Crm_Project_Note_Model
,
Crm_Source_Model
,
Deal_Attachment_Model
,
Deal_Event_Model
,
Deal_Model
,
Advertisement_Group_Advertisement_Model
,
Deal_Note_Model
,
Deal_Shop_Item_Model
,
Deal_Siteuser_Model
,
Deal_Step_Model
,
Deal_Step_User_Model
,
Deal_Template_Model
,
Deal_Template_Property_Dir_Model
,
Deal_Template_Property_List_Model
,
Deal_Template_Property_Model
,
Deal_Template_Step_Access_Department_Model
,
Advertisement_Group_List_Model
,
Deal_Template_Step_Access_User_Model
,
Deal_Template_Step_Conversion_Model
,
Deal_Template_Step_Model
,
Directory_Address_Model
,
Directory_Address_Type_Model
,
Directory_Email_Model
,
Directory_Email_Type_Model
,
Directory_Messenger_Model
,
Directory_Messenger_Type_Model
,
Directory_Phone_Model
Copyright: © 2005-2021 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru
Author: Hostmake LLC
Version: 6.x
Located at core/orm.php
Methods summary
public
mixed
|
|
public
string
|
|
public
string
|
|
public
|
|
public static
string
|
|
public static
|
|
public
|
#
find( mixed $primaryKey = NULL, boolean $bCache = TRUE )
Find object in database and load one. Use clear() before find() with conditions! |
public
array
|
|
public
boolean
|
#
chunk( integer $count, callable $callback, boolean $bCache = TRUE )
Retrieve a small chunk and feeds each one into $callback for processing. It stops looping when $callback returns FALSE |
public
|
|
public
integer|false
|
#
getCount( boolean $bCache = TRUE, string $fieldName = '*', boolean $distinct = FALSE )
Get count object |
public
null|
|
|
public
null|
|
|
public
|
|
public
|
|
public
boolean
|
|
public
|
|
protected
|
|
public
string
|
|
public static
|
|
protected
|
|
protected
|
|
public
|
|
public
|
|
protected
|
|
protected
|
|
protected
|
|
public
|
|
public static
|
|
public static
|
#
clearRelationModelCache( mixed $modelName = NULL )
Clear self::$_relationModelCache and Core_ORM_RelationCache |
protected
|
|
public
array
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
object
|
|
public
mixed
|
|
public
|
#
isCallable( string $methodName )
Verify that the contents of a variable can be called as a function |
public
boolean
|
|
public
|
|
public
mixed
|
#
__call( string $name, array $arguments )
Triggered when invoking inaccessible methods in an object context |
public
array
|
|
protected
mixed
|
|
public
|
#
check( boolean $exception = FALSE )
Check model values. If model has incorrect value, one will correct or call exception. |
public
|
|
public
|
|
public
|
|
public
array
|
|
public
|
|
public
|
|
public
string
|
|
public
array
|
|
public
|
|
public
|
Properties summary
protected
string
|
$_primaryKey
Primary key |
#
'id'
|
protected
mixed
|
$_modelName
Model name, e.g. 'book' for 'Book_Model' |
#
NULL
|
protected
array
|
$_modelColumns
List of columns in model with values |
#
array()
|
protected
mixed
|
$_tableName
Table name, e.g. 'books' for 'Book_Model' |
#
NULL
|
protected
array
|
$_tableColumns
List of columns in table |
#
array()
|
protected
array
|
$_preloadValues
List of preloaded values those will set for new object which does not have primary key |
#
array()
|
protected
array
|
$_skipColumns
List of skipped columns from table |
#
array()
|
protected
array
|
$_changedColumns
List of changed columns |
#
array()
|
protected
array
|
$_dataValues
data-values, e.g. dataMyValue |
#
array()
|
protected
array
|
$_relations
List of all relations are created by _relations() based on _hasOne, _hasMany and _belongsTo array('field_name' => array( 'type' => Type of relation: one|many 'model' => Model name 'foreign_key' => Foreign key 'primary_key' => Primary key in the parent table 'through' => Model name for many-to-many relation 'through_table_name' => Table name for many-to-many relation 'dependent_key' => Dependent child's key in "through" table ) ) |
#
array()
|
protected
array
|
$_hasMany
One-to-many or many-to-many relations |
#
array()
|
protected
array
|
$_hasOne
One-to-one relations |
#
array()
|
protected
array
|
$_belongsTo
Belongs to relations |
#
array()
|
public static
mixed
|
$config
ORM config |
#
NULL
|
public static
|
$cache
ORM cache |
#
NULL
|
public static
|
$columnCache
ORM column cache |
#
NULL
|
public static
|
$relationCache
ORM relation cache |
#
NULL
|
protected
array
|
$_relationCache
Objects cache for _hasOne and _belongsTo |
#
array()
|
protected static
array
|
$_relationModelCache
Relations cache for models |
#
array()
|
protected static
array
|
$_columnCache
Columns cache for models |
#
array()
|
protected static
array
|
$_columnCacheDefaultValues
Columns cache for models default values |
#
array()
|
protected
array
|
$_database
Core_DataBase object |
#
array()
|
protected
|
$_queryBuilder
Select query builder |
#
NULL
|
protected
boolean
|
$_bSetPreloadValues
Preload values have been set |
#
FALSE
|
protected
boolean
|
$_loaded
Model has already been loaded from database |
#
FALSE
|
protected
|
$_saved
Model has already been saved into database NULL value used in the __set() for separate value settings through mysql_fetch_object() |
#
NULL
|
protected
array
|
$_sorting
Default sorting for models protected $_sorting = array( 'tablename.sorting' => 'ASC' ); |
#
array()
|
protected static
string
|
$_databaseDriver
Database driver's name, default is 'default' |
#
'default'
|