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


PHP Doctrine::generateModelsFromDb方法代码示例

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


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

示例1: index

 function index()
 {
     spl_autoload_register(array('Doctrine', 'autoload'));
     $manager = Doctrine_Manager::getInstance();
     $conn = Doctrine_Manager::connection('mysql://root:root@localhost/moqold', 'doctrine');
     Doctrine::generateModelsFromDb('system/application/models', array('moqold'), array('generateTableClasses' => true));
     echo Doctrine::getPath();
 }
开发者ID:unixmiah,项目名称:codeigniter-doctrine-extjs,代码行数:8,代码来源:docTest.php

示例2: main

 /**
  * Main entry point for task
  */
 public function main()
 {
     if (empty($this->_dir)) {
         throw new Exception("Dir not configured ");
     }
     $manager = Doctrine_Manager::getInstance();
     // Set up validation
     $manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL);
     $conn = Doctrine_Manager::connection($this->_dsn->_toString());
     $conn->setAttribute('portability', Doctrine::PORTABILITY_ALL);
     $conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true);
     Doctrine::generateModelsFromDb($this->_dir, array(), $this->_options);
 }
开发者ID:jkinner,项目名称:ringside,代码行数:16,代码来源:DoctrineImportTask.php

示例3: generateAction

 public function generateAction()
 {
     //auto-generate models
     //these files will be saved under c:/tmp/models
     $path = '/tmp/models';
     $result = Doctrine::generateModelsFromDb($path, array('doctrine'), array('classPrefix' => 'Webteam_Model_'));
     if ($result) {
         $this->_helper->getHelper('FlashMessenger')->addMessage('The models were successfully generated under the folder ' . $path);
         $this->_redirect('/admin/doctrine/success');
     } else {
         throw new Zend_Controller_Action_Exception('Error while generating models.');
     }
 }
开发者ID:BGCX067,项目名称:fall2011-cis553-svn-to-git,代码行数:13,代码来源:ModelGeneratorController.php

示例4: index

 public function index()
 {
     if ($this->input->post("generate")) {
         // drop unnecessary auto-generated tables
         $statement = "DROP TABLE IF EXISTS `doctrine_lock_tracking`;";
         Doctrine_Manager::connection()->execute($statement);
         $path = APPPATH . 'models/doctrine';
         Doctrine::generateModelsFromDb($path, array(Doctrine_Manager::connection()->getName()));
         Session::instance()->set("message", "process completed: connection " . Doctrine_Manager::connection()->getName());
         url::redirect(url::current(true));
     }
     $session_message = Session::instance()->get_once("message");
     $view = $session_message ? "<p><strong>" . $session_message . "</strong></p>" : null;
     $view .= "<form action=\"" . url::current(true) . "\" method=\"post\">";
     $view .= "<input type=\"submit\" name=\"generate\" value=\"click to generate: connection " . Doctrine_Manager::connection()->getName() . "\" />";
     $view .= "</form>";
     echo $view;
 }
开发者ID:darkcolonist,项目名称:kohana234-doctrine115,代码行数:18,代码来源:setup.php

示例5: spl_autoload_register

<?php

spl_autoload_register(array("Doctrine", "autoload"));
//$conn=Doctrine_Manager::connection();
$dirdb = dirname(__FILE__) . "/../../../tmp/db/" . $project;
if (file_exists($dirdb)) {
    Oraculum_Scaffolding::rmdirrec($dirdb);
}
mkdir($dirdb);
if (Doctrine::generateModelsFromDb($dirdb)) {
    $dirdbdest = dirname(__FILE__) . "/../../../apps/" . $project . "/models/entidades";
    if (file_exists($dirdbdest)) {
        Oraculum_Scaffolding::rmdirrec($dirdbdest);
    }
    if (rename(dirname(__FILE__) . "/../../../tmp/db/" . $project, $dirdbdest)) {
        echo "Classes geradas com sucesso!";
    } else {
        echo "Classes geradas com sucesso!";
        echo "<br />Por&eacute;m n&atilde;o foi poss&iacute;vel move-las para a pasta do projeto";
        echo "<br />Copie o conte&uacute;do da pasta <code>./tmp/db/" . $project . "</code> para ";
        echo "<code>./apps/" . $project . "/models/entidades</code>";
    }
} else {
    echo "N&atilde;o foi poss&iacute;vel gerar as classes da camada de modelo do projeto!";
}
开发者ID:patrix,项目名称:oraculum,代码行数:25,代码来源:generate.php

示例6: doctrine_create_models_db

/**
 * Generate Models from Database Tables
 */
function doctrine_create_models_db()
{
    Doctrine::generateModelsFromDb(MODELS_DIRECTORY);
}
开发者ID:silentworks,项目名称:codeigniter_doctrine,代码行数:7,代码来源:doctrine_pi.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: dirname

<?php

require dirname(__FILE__) . '/../application/global.php';
#$cli = new Doctrine_Cli(Zend_Registry::get('doctrine_config'));
$dconfig = Zend_Registry::get('doctrine_config');
if (isset($_GET['arg'])) {
    if ($_GET['arg'] == 'gen_models') {
        echo "Generating Models <br />\n";
        echo Doctrine::generateModelsFromDb($dconfig["models_path"]);
        //echo Doctrine::generateModelsFromDb();
    } else {
        if ($_GET['arg'] == 'gen_yaml_from_db') {
            echo "Generating Yaml From DB <br />\n";
            echo Doctrine::generateYamlFromDb($dconfig["yaml_schema_path"]);
        }
    }
}
#var_dump ($dconfig);
?>

<br />
<br />
<a href="/ds.php?arg=gen_models">gen_models</a> <br />
<a href="/ds.php?arg=gen_yaml_from_db">gen_yaml_from_db</a> <br />


开发者ID:adnanali,项目名称:munch,代码行数:24,代码来源:doctrine.php

示例9: require_once

<?php

require_once('doctrine/lib/Doctrine.php');

spl_autoload_register(array('Doctrine', 'autoload'));
$ini_array = parse_ini_file('settings.ini');
define('DSN', 'pgsql://' . $ini_array['username'] . ':'. $ini_array['password'] .'@localhost/artist_alert');
Doctrine_Manager::connection(DSN);

// import method takes one parameter: the import directory (the directory where
// the generated record files will be put in
Doctrine::generateModelsFromDb('classes');
开发者ID:prismhdd,项目名称:victorioussecret,代码行数:12,代码来源:generate_records.php

示例10: execute

 public function execute()
 {
     Doctrine::generateModelsFromDb($this->getArgument('models_path'), (array) $this->getArgument('connection'));
     $this->dispatcher->notify('Generated models successfully from databases');
 }
开发者ID:walterfrs,项目名称:mladek,代码行数:5,代码来源:GenerateModelsDb.php

示例11: array

$manager = Doctrine_Manager::getInstance();
//Le digo a doctrine que exporte constrains, tablas y todo lo que pueda
$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::generateModelsFromDb('../../model', array($GLOBALS["dbName"]), array('generateTableClasses' => true));
开发者ID:nachovz,项目名称:EAC,代码行数:30,代码来源:generateModelFromSQL.php

示例12: array

<?php

include '../core/codon.config.php';
Doctrine::generateModelsFromDb(DOCTRINE_MODELS, array('doctrine'), array('generateTableClasses' => true));
开发者ID:ryanunderwood,项目名称:phpVMS,代码行数:4,代码来源:doctrine_generate.php

示例13: generateYamlFromDb

 /**
  * generateYamlFromDb
  *
  * Generates models from database to temporary location then uses those models to generate a yaml schema file.
  * This should probably be fixed. We should write something to generate a yaml schema file directly from the database.
  *
  * @param string $yamlPath Path to write oyur yaml schema file to
  * @return void
  */
 public static function generateYamlFromDb($yamlPath)
 {
     $directory = '/tmp/tmp_doctrine_models';
     Doctrine::generateModelsFromDb($directory);
     $export = new Doctrine_Export_Schema();
     $result = $export->exportSchema($yamlPath, 'yml', $directory);
     exec('rm -rf ' . $directory);
     return $result;
 }
开发者ID:kirvin,项目名称:the-nerdery,代码行数:18,代码来源:Doctrine.php

示例14: generateMigrationsFromDb

 /**
  * generateMigrationsFromDb
  *
  * @return void
  */
 public function generateMigrationsFromDb()
 {
     $directory = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'tmp_doctrine_models';
     Doctrine::generateModelsFromDb($directory);
     $result = $this->generateMigrationsFromModels($directory, Doctrine::MODEL_LOADING_CONSERVATIVE);
     Doctrine_Lib::removeDirectories($directory);
     return $result;
 }
开发者ID:prismhdd,项目名称:victorioussecret,代码行数:13,代码来源:Builder.php

示例15: dirname

#!/usr/bin/php
<?php 
require_once dirname(dirname(__FILE__)) . '/lib/doctrine/lib/Doctrine.php';
spl_autoload_register(array('Doctrine', 'autoload'));
$stdin = fopen('php://stdin', 'r');
$queries = array('db_host', 'db_name', 'db_user', 'db_passwd', 'target_dir');
foreach ($queries as $var) {
    ${$var} = null;
}
foreach ($queries as $var) {
    echo '$' . $var . ':';
    ${$var} = trim(fgets($stdin));
}
if (!file_exists($target_dir)) {
    mkdir($target_dir, 0755, true);
}
echo "\nDUMP:\n";
foreach ($queries as $var) {
    echo "- \${$var}=" . ${$var} . chr(10);
}
echo "\n";
Doctrine_Manager::connection("mysql://{$db_user}:{$db_passwd}@{$db_host}/{$db_name}", 'default');
Doctrine::generateModelsFromDb($target_dir, array('default'), array('generateTableClasses' => true));
fclose($stdin);
开发者ID:philippjenni,项目名称:icinga-web,代码行数:24,代码来源:doctrinemodels.php


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