I have often seen tables are retrieved in SocialEngine using Engine_Api::_()->getDbTable()
.
For example:
$usersTbl = Engine_Api::_()->getDbTable('users','user');
$row = $usersTbl->createRow();
$row->user_id = $user->getIdentity();
$row->phone_number = $phoneNumber;
$row->save();
However, I also see that SocialEngine has used Engine_Api::_()->getItemTable
in many places. For example:
$table = Engine_Api::_()->getItemTable($type);
$row = $table->createRow();
foreach($params as $key=>$value) {
if(isset($row->$key)) {
$row->key = $value;
}
}
$row->save();
What is the main difference between these two types of accesses, if any, and when is each one used?
Engine
folder is SocialEngine CMS on top of zend, here you find all the function definitions/application/modules/moduleName/settings/manifest.php
[Here you add items, in a module]when application is loaded, all manifest files are scanned and items are loaded.
getItemTable
can only load, DbTable class when item is defined.where as getDbTable() can be used for tables which are not used as Items.