return array( 'adapter' => '%adapter%', 'config' => array( 'host' => '%host%', 'username' => '%username%', 'password' => '%password%', 'dbname' => '%dbname%', ), );
return array( 'Zend_Db_Adapter' => array( 'adapter' => '%adapter%', 'config' => array( 'host' => '%host%', 'username' => '%username%', 'password' => '%password%', 'dbname' => '%dbname%', ), ) );
return array( 'engine' => function() { return new DragonX_Storage_Engine_ZendDbAdataper(Zend_Registry::get('Zend_Db_Adapter')); }, );
return array( 'DragonX_Storage_Engine' => array( 'engine' => function() { return new DragonX_Storage_Engine_ZendDbAdataper(Zend_Registry::get('Zend_Db_Adapter')); }, ) );
class %packagenamespace%_%packagename%_Record_%recordname% extends DragonX_Storage_Record_Abstract { public $attribute; }
class %packagenamespace%_%packagename%_Record_%recordname% extends DragonX_Storage_Record_Abstract { protected $_attribute; public function setAttribute($attribute) { $this->_attribute = $attribute; } public function getAttribute() { return $this->_attribute; } }
//Neue leere Records $record = new %packagenamespace%_%packagename%_Record_%recordname%(); //Records mit einer ID zum späteren Laden $record = new %packagenamespace%_%packagename%_Record_%recordname%(%id%); //Records mit Daten zum späteren Speichern $data = array('attribut' => 'value'); $record = new %packagenamespace%_%packagename%_Record_%recordname%($data); //Records mit Daten aus anderen Records $record = new %packagenamespace%_%packagename%_Record_%recordname%($record);
$record = new %packagenamespace%_%packagename%_Record_%recordname%(array( 'attribute' => 'value', )); Zend_Registry::get('DragonX_Storage_Engine')->save($record);
$record = Zend_Registry::get('DragonX_Storage_Engine')->load( new %packagenamespace%_%packagename%_Record_%recordname%(%id%) );
$storage = Zend_Registry::get('DragonX_Storage_Engine'); $record = $storage->load( new %packagenamespace%_%packagename%_Record_%recordname%(%id%) ); $record->attribute = 'value'; $storage->save($record);
Zend_Registry::get('DragonX_Storage_Engine')->delete( new %packagenamespace%_%packagename%_Record_%recordname%(%id%) );
class %packagenamespace%_%packagename%_%classname% extends DragonX_Storage_Record_Abstract { public $array = array('key' => 'value'); } //Spaltenname in der Datenbank wäre in diesem Fall 'array_key'
$list = new DragonX_Storage_RecordList(); $list[] = new %packagenamespace%_%packagename%_Record_%recordname%(); $list[] = new %packagenamespace%_%packagename%_Record_%recordname%();
//Sublist über Klassenname $sublist = $list->indexByClassname(); list($record) = $sublist['%classname%']; //Sublist über Namespace $sublist = $list->indexByNamepsace(); list($record) = $sublist['%namespace%']; //Sublist über einzelnes Attribut $sublist = $list->indexBy('attributename'); list($record) = $sublist['attribute']; //Sublist über mehrere Attribute $sublist = $list->indexBy(array('attributenameA', 'attributenameB')); list($record) = $sublist['attributeA']['attributeB'];
$storage = Zend_Registry::get('DragonX_Storage_Engine'); $list = $storage->loadBySqlStatement( new %packagenamespace%_%packagename%_Record_%recordname%(), "SELECT columnnameA, columnnameB FROM tablenameA INNER JOIN tablenameB USING(id) WHERE conditionname = :conditionname", array('conditionname' => 'conditionvalue') ); foreach ($list as $record) { $record->columnnameB += 1; } $storage->saveList($list);
$logicDatabase = new DragonX_Storage_Logic_Database(); $logicDatabase->installPackages();
class %packagenamespace%_%packagename%_Plugin_Install_%tablename% implements DragonX_Storage_Plugin_Install_Interface { public function install($storage, $version = '0.0.0') { if (version_compare($version, '1.0.0', '<')) { $storage->executeSqlStatement("%sqlstatement%"); } } }
class %packagenamespace%_%packagename%_Plugin_Install_%tablename% implements DragonX_Storage_Plugin_GetStoragekey_Interface, DragonX_Storage_Plugin_Install_Interface { public function getStoragekey() { return '%storagekey%'; } public function install($storage, $version = '0.0.0') { if (version_compare($version, '1.0.0', '<')) { $storage->executeSqlStatement("%sqlstatement%"); } } }