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


PHP CakeSchema::load方法代码示例

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


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

示例1: _loadSchema

 /**
  * Prepares the Schema objects for database operations.
  *
  * @return void
  */
 protected function _loadSchema()
 {
     $name = $plugin = null;
     if (!empty($this->params['name'])) {
         $name = $this->params['name'];
     }
     if (!empty($this->params['plugin'])) {
         $plugin = $this->params['plugin'];
     }
     if (!empty($this->params['dry'])) {
         $this->_dry = true;
         $this->out(__d('cake_console', 'Performing a dry run.'));
     }
     $options = array('name' => $name, 'plugin' => $plugin);
     if (!empty($this->params['snapshot'])) {
         $fileName = rtrim($this->Schema->file, '.php');
         $options['file'] = $fileName . '_' . $this->params['snapshot'] . '.php';
     }
     $Schema = $this->Schema->load($options);
     if (!$Schema) {
         $this->err(__d('cake_console', 'The chosen schema could not be loaded. Attempted to load:'));
         $this->err(__d('cake_console', 'File: %s', $this->Schema->path . DS . $this->Schema->file));
         $this->err(__d('cake_console', 'Name: %s', $this->Schema->name));
         $this->_stop();
     }
     $table = null;
     if (isset($this->args[1])) {
         $table = $this->args[1];
     }
     return array(&$Schema, $table);
 }
开发者ID:sanyaade-machine-learning,项目名称:Catool,代码行数:36,代码来源:SchemaShell.php

示例2: array

 /**
  * Prepares the Schema objects for database operations.
  *
  * @return void
  */
 function _loadSchema()
 {
     $name = $plugin = null;
     if (!empty($this->params['name'])) {
         $name = $this->params['name'];
     }
     if (!empty($this->params['plugin'])) {
         $plugin = $this->params['plugin'];
     }
     if (!empty($this->params['dry'])) {
         $this->__dry = true;
         $this->out(__('Performing a dry run.'));
     }
     $options = array('name' => $name, 'plugin' => $plugin);
     if (!empty($this->params['snapshot'])) {
         $fileName = rtrim($this->Schema->file, '.php');
         $options['file'] = $fileName . '_' . $this->params['snapshot'] . '.php';
     }
     $Schema = $this->Schema->load($options);
     if (!$Schema) {
         $this->err(__('%s could not be loaded', $this->Schema->path . DS . $this->Schema->file));
         $this->_stop();
     }
     $table = null;
     if (isset($this->args[1])) {
         $table = $this->args[1];
     }
     return array(&$Schema, $table);
 }
开发者ID:robotarmy,项目名称:Phog,代码行数:34,代码来源:schema.php

示例3: _loadSchema

 /**
  * Prepares the Schema objects for database operations.
  *
  * @return void
  */
 protected function _loadSchema()
 {
     $name = $plugin = NULL;
     if (!empty($this->params['name'])) {
         $name = $this->params['name'];
     }
     if (!empty($this->params['plugin'])) {
         $plugin = $this->params['plugin'];
     }
     if (!empty($this->params['dry'])) {
         $this->_dry = TRUE;
         $this->out(__d('cake_console', 'Performing a dry run.'));
     }
     $options = array('name' => $name, 'plugin' => $plugin, 'connection' => $this->params['connection']);
     if (!empty($this->params['snapshot'])) {
         $fileName = basename($this->Schema->file, '.php');
         $options['file'] = $fileName . '_' . $this->params['snapshot'] . '.php';
     }
     $Schema = $this->Schema->load($options);
     if (!$Schema) {
         $this->err(__d('cake_console', '<error>Error</error>: The chosen schema could not be loaded. Attempted to load:'));
         $this->err(__d('cake_console', '- file: %s', $this->Schema->path . DS . $this->Schema->file));
         $this->err(__d('cake_console', '- name: %s', $this->Schema->name));
         return $this->_stop(2);
     }
     $table = NULL;
     if (isset($this->args[1])) {
         $table = $this->args[1];
     }
     return array(&$Schema, $table);
 }
开发者ID:mrbadao,项目名称:api-official,代码行数:36,代码来源:SchemaShell.php

示例4: _loadSchema

 /**
  * Prepares the Schema objects for database operations.
  *
  * @return void
  */
 protected function _loadSchema()
 {
     $name = $plugin = null;
     if (!empty($this->params['name'])) {
         $name = $this->params['name'];
     }
     if (!empty($this->params['plugin'])) {
         $plugin = $this->params['plugin'];
     }
     if (!empty($this->params['dry'])) {
         $this->_dry = true;
         $this->_out(__d('cake_console', 'Performing a dry run.'));
     }
     $options = array('name' => $name, 'plugin' => $plugin);
     if (!empty($this->params['snapshot'])) {
         $fileName = rtrim($this->Schema->file, '.php');
         $options['file'] = $fileName . '_' . $this->params['snapshot'] . '.php';
     }
     $Schema = $this->Schema->load($options);
     if (!$Schema) {
         $this->message[] = __(' ( %s has no database schema ) ', $options['name']);
         //$this->message[] = __(' ( could not load %s database schema ) ', $options['name']);
         //$this->_redirect($this->referer());
     }
     $table = null;
     if (isset($this->args[1])) {
         $table = $this->args[1];
     }
     return array(&$Schema, $table);
 }
开发者ID:ayaou,项目名称:Zuha,代码行数:35,代码来源:InstallController.php

示例5: _createSchema

 /**
  * Creates the schema.
  *
  * NOTE: adapted from the schema shell lib/Cake/Console/Command/SchemaShell.php
  * 
  * @return mixed false on failure, otherwise a string message
  */
 protected function _createSchema()
 {
     App::uses('ConnectionManager', 'Model');
     App::uses('CakeSchema', 'Model');
     $db = ConnectionManager::getDataSource('default');
     $CakeSchema = new CakeSchema(array('name' => 'App', 'connection' => $db));
     $Schema = $CakeSchema->load();
     if (!$Schema) {
         $this->error(sprintf('Schema could not be loaded: %s', $CakeSchema->path . DS . $CakeSchema->file));
         return false;
     }
     $out = '';
     $drop = $create = array();
     foreach ($Schema->tables as $table => $fields) {
         $drop[$table] = $db->dropSchema($Schema, $table);
         $create[$table] = $db->createSchema($Schema, $table);
     }
     if (empty($drop) || empty($create)) {
         $out .= 'Schema is up to date.';
         return $out;
     }
     $out .= "\n" . 'The following table(s) will be dropped.';
     $out .= "\n" . implode(", ", array_keys($drop));
     $out .= "\n" . 'Dropping table(s).';
     $result = $this->_runSchema($db, $drop, 'drop', $Schema);
     if ($result === false) {
         return false;
     } else {
         $out .= $result;
     }
     $out .= "\n" . 'The following table(s) will be created.';
     $out .= "\n" . implode(", ", array_keys($create));
     $out .= "\n" . 'Creating table(s).';
     $result = $this->_runSchema($db, $create, 'create', $Schema);
     if ($result === false) {
         return false;
     } else {
         $out .= $result;
     }
     $out .= "\n" . 'End create.';
     $this->log($out);
     return true;
 }
开发者ID:sanyaade-machine-learning,项目名称:Catool,代码行数:50,代码来源:install.php


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