public static function InjectModelDataDriver(EntityModel $model)
 {
     $entityModelClassName = get_class($model);
     $dataDriver = self::CreateDataDriver($entityModelClassName);
     if (!$dataDriver instanceof InMemoryDataDriver) {
         $entityClassName = preg_replace('/Model$/', '', $entityModelClassName);
         SurogateDataDriver::SetRealDataDriver(new MySQLDataDriver());
         $qdp = Project::GetQDP();
         EntityBuilder::BuildEntity($entityClassName, $dataDriver, null, true, false);
         $model->truncate();
     }
     EntityModel::InjectDataDriver($model, $dataDriver);
 }
Ejemplo n.º 2
0
<?php

include_once dirname(__FILE__) . "/project-settings.php";
include_once constant("PATH_TO_FRAMEWORK") . "/base/Base.php";
$mysql = new MySQLProvider("localhost", PROJECT_MYSQL_USERNAME, PROJECT_MYSQL_PASSWORD, PROJECT_MYSQL_DATABASE);
// create the project
$project = Project::Create(constant("PROJECT_NAME"), constant("PROJECT_TITLE"), constant("PROJECT_AUTHOR"), constant("PROJECT_DIR"), constant("PROJECT_TIMEZONE"));
// timezone
$application = Application::getInstance();
$project->setQueriedDataProvider($mysql);
$application->Start();
$mysql->connect();
SurogateDataDriver::SetRealDataDriver(new MySQLDataDriver());
include_once dirname(__FILE__) . "/functions.php";