当前位置: 首页>>代码示例>>PHP>>正文


PHP Doctrine::generateModelsFromYaml方法代码示例

本文整理汇总了PHP中Doctrine::generateModelsFromYaml方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine::generateModelsFromYaml方法的具体用法?PHP Doctrine::generateModelsFromYaml怎么用?PHP Doctrine::generateModelsFromYaml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine的用法示例。


在下文中一共展示了Doctrine::generateModelsFromYaml方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doctrineAction

 public function doctrineAction()
 {
     $options = array('phpDocPackage' => 'Kromatick', 'phpDocSubpackage' => 'Intermodels', 'phpDocName' => 'Neozeratul', 'phpDocEmail' => 'neozeratul@gmail.com');
     Doctrine::dropDatabases();
     Doctrine::createDatabases();
     Doctrine::generateModelsFromYaml(APPLICATION_PATH . "/data/schema/schema.yml", APPLICATION_PATH . "/models", $options);
     Doctrine::createTablesFromModels();
     //Doctrine::loadData($yamlPath, $append):
     echo Doctrine::generateSqlFromModels();
     $this->render('index');
 }
开发者ID:Neozeratul,项目名称:Intermodels,代码行数:11,代码来源:IndexController.php

示例2: execute

 public function execute()
 {
     Doctrine::generateModelsFromYaml($this->getArgument('yaml_schema_path'), $this->getArgument('models_path'), $this->getArgument('generate_models_options', array()));
     $this->notify('Generated models successfully from YAML schema');
 }
开发者ID:stelaireri,项目名称:Hive,代码行数:5,代码来源:GenerateModelsYaml.php

示例3: realpath

 * @author     Dejan Spasic <spasic.dejan@yahoo.de>
 * @version    SVN: $Id: bootstrap.php 20057 2009-07-09 13:40:40Z Dejan.Spasic $
 */
// Autofind the first available app environment
$sfRootDir = realpath(dirname(__FILE__) . '/../../../');
$appsDir = glob($sfRootDir . '/apps/*', GLOB_ONLYDIR);
$app = substr($appsDir[0], strrpos($appsDir[0], DIRECTORY_SEPARATOR) + 1, strlen($appsDir[0]));
if (!$app) {
    throw new Exception('No app has been detected in this project');
}
// -- path to the symfony project where the plugin resides
$sfPath = dirname(__FILE__) . '/../../..';
// bootstrap
include $sfPath . '/test/bootstrap/unit.php';
// initialize database manager
new sfDatabaseManager(ProjectConfiguration::getActive());
// initialize database connection for our tests
Doctrine_Manager::connection('sqlite::memory:', '_test_graphiz');
// clean the model directory
try {
    $_fs = new sfFilesystem();
    $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__) . '/_files/model'), RecursiveIteratorIterator::CHILD_FIRST);
    foreach ($it as $file) {
        $_fs->remove($file->getPathname());
    }
    $_fs->remove(dirname(__FILE__) . '/_files/model');
} catch (Exception $e) {
}
// generate the model
Doctrine::generateModelsFromYaml(dirname(__FILE__) . '/_files', dirname(__FILE__) . '/_files/model');
开发者ID:yuxw75,项目名称:Surrogate,代码行数:30,代码来源:bootstrap.php

示例4: doctrine_create_models

/**
 * Generates Models from YAML Schema file
 * @param string $name
 */
function doctrine_create_models($name = NULL)
{
    if ($name === NULL) {
        $location = SCHEMA_DIRECTORY;
    } else {
        $location = SCHEMA_DIRECTORY . $name;
    }
    Doctrine::generateModelsFromYaml($location, MODELS_DIRECTORY);
}
开发者ID:silentworks,项目名称:codeigniter_doctrine,代码行数:13,代码来源:doctrine_pi.php

示例5: define

<?php

define("CLASSPATH", realpath(dirname(__FILE__) . "/../.."));
define("DOCTRINE_FOLDER", CLASSPATH . "/3rdParty/Doctrine-1.1.0/lib");
define("MODELS_FOLDER", CLASSPATH . "/models/data_objects");
define("YML_FOLDER", CLASSPATH . "/models/yml");
require_once DOCTRINE_FOLDER . '/Doctrine.php';
require_once CLASSPATH . '/config/db.conf.php';
spl_autoload_register(array('Doctrine', 'autoload'));
$manager = Doctrine_Manager::getInstance();
$conn = Doctrine_Manager::connection("{$db_conn_type}://{$db_user}:{$db_pass}@{$db_host}/{$db_name}", 'doctrine');
$manager->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE);
$conn->setAttribute(Doctrine::ATTR_USE_NATIVE_ENUM, true);
Doctrine::dropDatabases();
Doctrine::createDatabases();
Doctrine::generateModelsFromYaml(YML_FOLDER . '/db.yml', MODELS_FOLDER);
Doctrine::createTablesFromModels(MODELS_FOLDER);
开发者ID:p1r0,项目名称:MuffinPHP,代码行数:17,代码来源:generateModels.php

示例6: dirname

<?php

/**
 * Script for creating and loading database
 */
include_once dirname(__FILE__) . '/../../../application/bootstrap.php';
echo 'Generating models from schemas' . PHP_EOL;
try {
    Doctrine::generateModelsFromYaml('user.yml', APPLICATION_PATH . '/models');
    Doctrine::createTablesFromArray(array('User'));
} catch (Exception $e) {
    echo 'AN ERROR HAS OCCURED:' . PHP_EOL;
    echo $e->getMessage() . PHP_EOL;
    return false;
}
// Generally speaking, this script will be run from the command line
return true;
开发者ID:RobertGresdal,项目名称:robbiegee-code-samples,代码行数:17,代码来源:generate-db.php

示例7: _generateModels

 /**
  * Generate a set of models for the schema information source
  *
  * @param  string $prefix  Prefix to generate the models with
  * @param  mixed  $item    The item to generate the models from
  * @return string $path    The path where the models were generated
  * @throws Doctrine_Migration_Exception $e
  */
 protected function _generateModels($prefix, $item)
 {
     $path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . strtolower($prefix) . '_doctrine_tmp_dirs';
     $options = array('classPrefix' => $prefix);
     if (is_string($item) && file_exists($item)) {
         if (is_dir($item)) {
             $files = glob($item . DIRECTORY_SEPARATOR . '*.*');
         } else {
             $files = array($item);
         }
         if (isset($files[0])) {
             $pathInfo = pathinfo($files[0]);
             $extension = $pathInfo['extension'];
         }
         if ($extension === 'yml') {
             Doctrine::generateModelsFromYaml($item, $path, $options);
             return $path;
         } else {
             if ($extension === 'php') {
                 Doctrine_Lib::copyDirectory($item, $path);
                 return $path;
             } else {
                 throw new Doctrine_Migration_Exception('No php or yml files found at path: "' . $item . '"');
             }
         }
     } else {
         try {
             Doctrine::generateModelsFromDb($path, (array) $item, $options);
             return $path;
         } catch (Exception $e) {
             throw new Doctrine_Migration_Exception('Could not generate models from connection: ' . $e->getMessage());
         }
     }
 }
开发者ID:hasanozgan,项目名称:kissabe,代码行数:42,代码来源:Diff.php

示例8:

$manager->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL);
//Le digo a doctrine que realice todas las validaciones de integridad: valores nulos, constrains, etc.
$manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL);
//Permito los override en las clases
$manager->setAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true);
if ($GLOBALS["BDLazyMode"]) {
    $manager->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE);
} else {
    $manager->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_AGGRESSIVE);
}
//Cargo todo el modelo
if (file_exists('../../model/generated')) {
    Doctrine::loadModels('../../model/generated');
} else {
    if ($GLOBALS["debugMode"]) {
        echo "No se ha encontrador el directorio 'model/generated'";
    }
}
if (file_exists('../../model')) {
    Doctrine::loadModels('../../model');
} else {
    if ($GLOBALS["debugMode"]) {
        echo "No se ha encontrador el directorio 'model'";
    }
}
//Debo hace un aggressive loadin de manera obligarotia, sino no se cargan todas las clases
$manager->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_AGGRESSIVE);
Doctrine::dropDatabases();
Doctrine::createDatabases();
Doctrine::generateModelsFromYaml('../../schema.yml', '../../model');
开发者ID:nachovz,项目名称:EAC,代码行数:30,代码来源:generateModelFromYML.php

示例9:

<?php

require_once '../Plans.php';
Doctrine::generateModelsFromYaml('../db/schema.yaml', '../db/');
开发者ID:acohn,项目名称:grinnellplans-php,代码行数:4,代码来源:yaml-to-php.php


注:本文中的Doctrine::generateModelsFromYaml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。