mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 00:48:25 +00:00
"Updating console scripts to use App::import()"
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6013 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
f786c266c2
commit
cae7db2011
3 changed files with 5 additions and 5 deletions
|
@ -208,7 +208,7 @@ class Shell extends Object {
|
|||
'model'.DS.'datasources'.DS.'dbo_source', 'model'.DS.'model'
|
||||
);
|
||||
|
||||
if ($this->uses === true && loadModel()) {
|
||||
if ($this->uses === true && App::import('Model', 'AppModel')) {
|
||||
$this->AppModel = & new AppModel(false, false, false);
|
||||
return true;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ class Shell extends Object {
|
|||
$modelKey = Inflector::underscore($modelClass);
|
||||
|
||||
if (!class_exists($modelClass)) {
|
||||
loadModel($modelClass);
|
||||
App::import('Model', $modelClass);
|
||||
}
|
||||
if (class_exists($modelClass)) {
|
||||
$model =& new $modelClass();
|
||||
|
|
|
@ -238,7 +238,7 @@ class ControllerTask extends Shell {
|
|||
*/
|
||||
function __bakeActions($controllerName, $admin = null, $wannaUseSession = true) {
|
||||
$currentModelName = $this->_modelName($controllerName);
|
||||
if (!loadModel($currentModelName)) {
|
||||
if (!App::import('Model', $currentModelName)) {
|
||||
$this->err('You must have a model for this class to build scaffold methods. Please try again.');
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ class ModelTask extends Shell {
|
|||
$wannaDoValidation = $this->in('Would you like to supply validation criteria for the fields in your model?', array('y','n'), 'y');
|
||||
|
||||
if (in_array($useTable, $this->__tables)) {
|
||||
loadModel();
|
||||
App::import('Model');
|
||||
$tempModel = new Model(false, $useTable);
|
||||
$modelFields = $db->describe($tempModel);
|
||||
|
||||
|
@ -576,7 +576,7 @@ class ModelTask extends Shell {
|
|||
*/
|
||||
function __bakeTest($className) {
|
||||
$out = '<?php '."\n\n";
|
||||
$out .= "loadModel('$className');\n\n";
|
||||
$out .= "App::import('Model', '$className');\n\n";
|
||||
$out .= "class {$className}TestCase extends CakeTestCase {\n";
|
||||
$out .= "\tvar \$TestObject = null;\n\n";
|
||||
$out .= "\tfunction setUp() {\n\t\t\$this->TestObject = new {$className}();\n";
|
||||
|
|
Loading…
Add table
Reference in a new issue