* * You should have received a copy of the GNU Lesser General Public License * along with the APF. If not, see http://www.gnu.org/licenses/lgpl-3.0.txt. * --> */ echo 'This is a sample update script, that must be adapted to your requirements! ' . 'Please do not use as is to avoid unexpected results! :)'; exit(0); // include APF bootstrap file require './APF/core/bootstrap.php'; // configure the registry if desired use APF\core\registry\Registry; Registry::register('APF\\core', 'Environment', '{ENVIRONMENT}'); use APF\modules\genericormapper\data\tools\GenericORMapperManagementTool; // create update tool $update = new GenericORMapperManagementTool(); // set context (important for the configuration files!) $update->setContext('{CONTEXT}'); // adapt storage engine (default is MyISAM) //$update->setStorageEngine('MyISAM|INNODB'); // adapt data type of the indexed columns, that are used for object ids //$update->setIndexColumnDataType('INT(5) UNSIGNED'); // initialize mapping configuration $update->addMappingConfiguration('{CONFIG_NAMESPACE}', '{CONFIG_NAME_AFFIX}'); // initialize relation configuration $update->addRelationConfiguration('{CONFIG_NAMESPACE}', '{CONFIG_NAME_AFFIX}'); // initialize database connection (optional; if not set, statements will be printed instead if direct update) $update->setConnectionName('{CONNECTION_NAME}'); // update database layout directly $update->run(true); // display statements only $update->run(false);
<?php /** * In order to use this script for database setup, include this file after including the * <em>bootstrap.php</em> file and setting the context and connection key. * * @example * <code> * include('./APF/core/bootstrap.php'); * $context = 'mycontext'; * $connectionKey = 'mysql-db'; * include('./APF/modules/guestbook2009/data/setup/setup.php'); * </code> * * Please note, that you may have to adapt the include path for the <em>bootstrap.php</em>. */ use APF\modules\genericormapper\data\tools\GenericORMapperManagementTool; $setup = new GenericORMapperManagementTool(); $setup->setContext($context); $setup->addMappingConfiguration('APF\\modules\\guestbook2009\\data', 'guestbook2009'); $setup->addRelationConfiguration('APF\\modules\\guestbook2009\\data', 'guestbook2009'); $setup->setConnectionName($connectionKey); $setup->run();