mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Little cleanup in exceptions.
- Removed duplicated or non-used exceptions. - Making the error messages more descriptive and stardard.
This commit is contained in:
parent
3ed712e745
commit
1cf67b1e55
22 changed files with 89 additions and 271 deletions
|
@ -201,12 +201,11 @@ class ShellDispatcher {
|
|||
*
|
||||
* @param string $shell Optionally the name of a plugin
|
||||
* @return mixed An object
|
||||
* @throws MissingShellFileException when errors are encountered.
|
||||
* @throws MissingShellException when errors are encountered.
|
||||
*/
|
||||
protected function _getShell($shell) {
|
||||
list($plugin, $shell) = pluginSplit($shell, true);
|
||||
|
||||
|
||||
$class = Inflector::camelize($shell) . 'Shell';
|
||||
|
||||
App::uses('Shell', 'Console');
|
||||
|
@ -214,7 +213,9 @@ class ShellDispatcher {
|
|||
App::uses($class, $plugin . 'Console/Command');
|
||||
|
||||
if (!class_exists($class)) {
|
||||
throw new MissingShellFileException(array('shell' => $shell));
|
||||
throw new MissingShellException(array(
|
||||
'class' => $class
|
||||
));
|
||||
}
|
||||
$Shell = new $class();
|
||||
return $Shell;
|
||||
|
|
|
@ -54,7 +54,7 @@ class TaskCollection extends ObjectCollection {
|
|||
* @param string $task Task name to load
|
||||
* @param array $settings Settings for the task.
|
||||
* @return Task A task object, Either the existing loaded task or a new one.
|
||||
* @throws MissingTaskFileException, MissingTaskClassException when the task could not be found
|
||||
* @throws MissingTaskException when the task could not be found
|
||||
*/
|
||||
public function load($task, $settings = array()) {
|
||||
list($plugin, $name) = pluginSplit($task, true);
|
||||
|
@ -66,7 +66,9 @@ class TaskCollection extends ObjectCollection {
|
|||
App::uses($taskClass, $plugin . 'Console/Command/Task');
|
||||
if (!class_exists($taskClass)) {
|
||||
if (!class_exists($taskClass)) {
|
||||
throw new MissingTaskClassException($taskClass);
|
||||
throw new MissingTaskException(array(
|
||||
'class' => $taskClass
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ class ComponentCollection extends ObjectCollection {
|
|||
* @param string $component Component name to load
|
||||
* @param array $settings Settings for the component.
|
||||
* @return Component A component object, Either the existing loaded component or a new one.
|
||||
* @throws MissingComponentFileException, MissingComponentClassException when the component could not be found
|
||||
* @throws MissingComponentException when the component could not be found
|
||||
*/
|
||||
public function load($component, $settings = array()) {
|
||||
if (is_array($settings) && isset($settings['className'])) {
|
||||
|
@ -90,8 +90,7 @@ class ComponentCollection extends ObjectCollection {
|
|||
$componentClass = $name . 'Component';
|
||||
App::uses($componentClass, $plugin . 'Controller/Component');
|
||||
if (!class_exists($componentClass)) {
|
||||
throw new MissingComponentClassException(array(
|
||||
'file' => Inflector::underscore($componentClass) . '.php',
|
||||
throw new MissingComponentException(array(
|
||||
'class' => $componentClass
|
||||
));
|
||||
}
|
||||
|
|
|
@ -241,37 +241,23 @@ class PrivateActionException extends CakeException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Used when a Component file cannot be found.
|
||||
* Used when a component cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingComponentFileException extends CakeException {
|
||||
protected $_messageTemplate = 'Component file "%s" is missing.';
|
||||
class MissingComponentException extends CakeException {
|
||||
protected $_messageTemplate = 'Component class %s could not be found.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when a Component class cannot be found.
|
||||
* Used when a behavior cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingComponentClassException extends CakeException {
|
||||
protected $_messageTemplate = 'Component class "%s" is missing.';
|
||||
class MissingBehaviorException extends CakeException {
|
||||
protected $_messageTemplate = 'Behavior class %s could not be found.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when a Behavior file cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingBehaviorFileException extends CakeException { }
|
||||
|
||||
/**
|
||||
* Used when a Behavior class cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingBehaviorClassException extends CakeException { }
|
||||
|
||||
/**
|
||||
* Used when a view file cannot be found.
|
||||
*
|
||||
|
@ -291,24 +277,14 @@ class MissingLayoutException extends CakeException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Used when a helper file cannot be found.
|
||||
* Used when a helper cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingHelperFileException extends CakeException {
|
||||
protected $_messageTemplate = 'Helper file "%s" is missing.';
|
||||
class MissingHelperException extends CakeException {
|
||||
protected $_messageTemplate = 'Helper class %s could not be found.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when a helper class cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingHelperClassException extends CakeException {
|
||||
protected $_messageTemplate = 'Helper class "%s" is missing.';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runtime Exceptions for ConnectionManager
|
||||
*
|
||||
|
@ -328,21 +304,12 @@ class MissingConnectionException extends CakeException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Used when a Task file cannot be found.
|
||||
* Used when a Task cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingTaskFileException extends CakeException {
|
||||
protected $_messageTemplate = 'Task file "%s" is missing.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when a Task class cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingTaskClassException extends CakeException {
|
||||
protected $_messageTemplate = 'Task class "%s" is missing.';
|
||||
class MissingTaskException extends CakeException {
|
||||
protected $_messageTemplate = 'Task class %s could not be found.';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -355,21 +322,12 @@ class MissingShellMethodException extends CakeException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Used when a shell class cannot be found.
|
||||
* Used when a shell cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingShellClassException extends CakeException {
|
||||
protected $_messageTemplate = "Shell class %s could not be loaded.";
|
||||
}
|
||||
|
||||
/**
|
||||
* Used when a shell file cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingShellFileException extends CakeException {
|
||||
protected $_messageTemplate = "Shell file %s could not be loaded.";
|
||||
class MissingShellException extends CakeException {
|
||||
protected $_messageTemplate = 'Shell class %s could not be found.';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -382,12 +340,12 @@ class MissingDatasourceConfigException extends CakeException {
|
|||
}
|
||||
|
||||
/**
|
||||
* Exception class to be thrown when a datasource is not found
|
||||
* Used when a datasource cannot be found.
|
||||
*
|
||||
* @package Cake.Error
|
||||
*/
|
||||
class MissingDatasourceFileException extends CakeException {
|
||||
protected $_messageTemplate = 'Datasource "%s" was not found.';
|
||||
class MissingDatasourceException extends CakeException {
|
||||
protected $_messageTemplate = 'Datasource class %s could not be found.';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -99,7 +99,7 @@ class BehaviorCollection extends ObjectCollection {
|
|||
* @param string $behavior CamelCased name of the behavior to load
|
||||
* @param array $config Behavior configuration parameters
|
||||
* @return boolean True on success, false on failure
|
||||
* @throws MissingBehaviorClassException when a behavior could not be found.
|
||||
* @throws MissingBehaviorException when a behavior could not be found.
|
||||
*/
|
||||
public function load($behavior, $config = array()) {
|
||||
if (is_array($config) && isset($config['className'])) {
|
||||
|
@ -115,8 +115,7 @@ class BehaviorCollection extends ObjectCollection {
|
|||
|
||||
App::uses($class, $plugin . 'Model/Behavior');
|
||||
if (!class_exists($class)) {
|
||||
throw new MissingBehaviorClassException(array(
|
||||
'file' => Inflector::underscore($behavior) . '.php',
|
||||
throw new MissingBehaviorException(array(
|
||||
'class' => $class
|
||||
));
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class ConnectionManager {
|
|||
* @param string $name The name of the DataSource, as defined in app/Config/database.php
|
||||
* @return DataSource Instance
|
||||
* @throws MissingDatasourceConfigException
|
||||
* @throws MissingDatasourceFileException
|
||||
* @throws MissingDatasourceException
|
||||
*/
|
||||
public static function getDataSource($name) {
|
||||
if (empty(self::$_init)) {
|
||||
|
@ -141,7 +141,7 @@ class ConnectionManager {
|
|||
* or an array containing the filename (without extension) and class name of the object,
|
||||
* to be found in app/Model/Datasource/ or lib/Cake/Model/Datasource/.
|
||||
* @return boolean True on success, null on failure or false if the class is already loaded
|
||||
* @throws MissingDatasourceFileException
|
||||
* @throws MissingDatasourceException
|
||||
*/
|
||||
public static function loadDataSource($connName) {
|
||||
if (empty(self::$_init)) {
|
||||
|
@ -168,7 +168,10 @@ class ConnectionManager {
|
|||
|
||||
App::uses($conn['classname'], $plugin . 'Model/Datasource' . $package);
|
||||
if (!class_exists($conn['classname'])) {
|
||||
throw new MissingDatasourceFileException(array('class' => $conn['classname'], 'plugin' => $plugin));
|
||||
throw new MissingDatasourceException(array(
|
||||
'class' => $conn['classname'],
|
||||
'plugin' => $plugin
|
||||
));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -70,12 +70,12 @@ class TaskCollectionTest extends CakeTestCase {
|
|||
$this->assertFalse($this->Tasks->enabled('DbConfig'), 'DbConfigTask should be disabled');
|
||||
}
|
||||
/**
|
||||
* test missinghelper exception
|
||||
* test missingtask exception
|
||||
*
|
||||
* @expectedException MissingTaskClassException
|
||||
* @expectedException MissingTaskException
|
||||
* @return void
|
||||
*/
|
||||
public function testLoadMissingTaskFile() {
|
||||
public function testLoadMissingTask() {
|
||||
$result = $this->Tasks->load('ThisTaskShouldAlwaysBeMissing');
|
||||
}
|
||||
|
||||
|
|
|
@ -111,10 +111,10 @@ class ComponentCollectionTest extends CakeTestCase {
|
|||
/**
|
||||
* test missingcomponent exception
|
||||
*
|
||||
* @expectedException MissingComponentClassException
|
||||
* @expectedException MissingComponentException
|
||||
* @return void
|
||||
*/
|
||||
public function testLoadMissingComponentFile() {
|
||||
public function testLoadMissingComponent() {
|
||||
$this->Components->load('ThisComponentShouldAlwaysBeMissing');
|
||||
}
|
||||
|
||||
|
|
|
@ -505,62 +505,36 @@ class ExceptionRendererTest extends CakeTestCase {
|
|||
500
|
||||
),
|
||||
array(
|
||||
new MissingDatasourceFileException(array('class' => 'MyDatasource', 'plugin' => 'MyPlugin')),
|
||||
new MissingDatasourceException(array('class' => 'MyDatasource', 'plugin' => 'MyPlugin')),
|
||||
array(
|
||||
'/<h2>Missing Datasource Class<\/h2>/',
|
||||
'/Datasource class <em>MyDatasource<\/em> was not found/'
|
||||
'/<h2>Missing Datasource<\/h2>/',
|
||||
'/Datasource class <em>MyDatasource<\/em> could not be found/'
|
||||
),
|
||||
500
|
||||
),
|
||||
array(
|
||||
new MissingHelperFileException(array('file' => 'MyCustomHelper.php', 'class' => 'MyCustomHelper')),
|
||||
new MissingHelperException(array('class' => 'MyCustomHelper')),
|
||||
array(
|
||||
'/<h2>Missing Helper File<\/h2>/',
|
||||
'/Create the class below in file:/',
|
||||
'/<h2>Missing Helper<\/h2>/',
|
||||
'/Create the class <em>MyCustomHelper<\/em> below in file:/',
|
||||
'/(\/|\\\)MyCustomHelper.php/'
|
||||
),
|
||||
500
|
||||
),
|
||||
array(
|
||||
new MissingHelperClassException(array('file' => 'MyCustomHelper.php', 'class' => 'MyCustomHelper')),
|
||||
new MissingBehaviorException(array('class' => 'MyCustomBehavior')),
|
||||
array(
|
||||
'/<h2>Missing Helper Class<\/h2>/',
|
||||
'/The helper class <em>MyCustomHelper<\/em> can not be found or does not exist./',
|
||||
'/(\/|\\\)MyCustomHelper.php/',
|
||||
),
|
||||
500
|
||||
),
|
||||
array(
|
||||
new MissingBehaviorFileException(array('file' => 'MyCustomBehavior.php', 'class' => 'MyCustomBehavior')),
|
||||
array(
|
||||
'/<h2>Missing Behavior File<\/h2>/',
|
||||
'/Create the class below in file:/',
|
||||
'/(\/|\\\)MyCustomBehavior.php/',
|
||||
),
|
||||
500
|
||||
),
|
||||
array(
|
||||
new MissingBehaviorClassException(array('file' => 'MyCustomBehavior.php', 'class' => 'MyCustomBehavior')),
|
||||
array(
|
||||
'/The behavior class <em>MyCustomBehavior<\/em> can not be found or does not exist./',
|
||||
'/<h2>Missing Behavior<\/h2>/',
|
||||
'/Create the class <em>MyCustomBehavior<\/em> below in file:/',
|
||||
'/(\/|\\\)MyCustomBehavior.php/'
|
||||
),
|
||||
500
|
||||
),
|
||||
array(
|
||||
new MissingComponentFileException(array('file' => 'SideboxComponent.php', 'class' => 'SideboxComponent')),
|
||||
new MissingComponentException(array('class' => 'SideboxComponent')),
|
||||
array(
|
||||
'/<h2>Missing Component File<\/h2>/',
|
||||
'/Create the class <em>SideboxComponent<\/em> in file:/',
|
||||
'/(\/|\\\)SideboxComponent.php/'
|
||||
),
|
||||
500
|
||||
),
|
||||
array(
|
||||
new MissingComponentClassException(array('file' => 'SideboxComponent.php', 'class' => 'SideboxComponent')),
|
||||
array(
|
||||
'/<h2>Missing Component Class<\/h2>/',
|
||||
'/Create the class <em>SideboxComponent<\/em> in file:/',
|
||||
'/<h2>Missing Component<\/h2>/',
|
||||
'/Create the class <em>SideboxComponent<\/em> below in file:/',
|
||||
'/(\/|\\\)SideboxComponent.php/'
|
||||
),
|
||||
500
|
||||
|
@ -620,7 +594,7 @@ class ExceptionRendererTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testMissingRenderSafe() {
|
||||
$exception = new MissingHelperFileException(array('class' => 'Fail'));
|
||||
$exception = new MissingHelperException(array('class' => 'Fail'));
|
||||
$ExceptionRenderer = new ExceptionRenderer($exception);
|
||||
|
||||
$ExceptionRenderer->controller = $this->getMock('Controller');
|
||||
|
@ -628,7 +602,7 @@ class ExceptionRendererTest extends CakeTestCase {
|
|||
$ExceptionRenderer->controller->request = $this->getMock('CakeRequest');
|
||||
$ExceptionRenderer->controller->expects($this->at(2))
|
||||
->method('render')
|
||||
->with('missingHelperFile')
|
||||
->with('missingHelper')
|
||||
->will($this->throwException($exception));
|
||||
|
||||
$ExceptionRenderer->controller->expects($this->at(3))
|
||||
|
|
|
@ -538,7 +538,7 @@ class BehaviorCollectionTest extends CakeTestCase {
|
|||
/**
|
||||
* test that attaching a non existant Behavior triggers a cake error.
|
||||
*
|
||||
* @expectedException MissingBehaviorClassException
|
||||
* @expectedException MissingBehaviorException
|
||||
* @return void
|
||||
*/
|
||||
public function testInvalidBehaviorCausingCakeError() {
|
||||
|
|
|
@ -224,7 +224,7 @@ class ConnectionManagerTest extends CakeTestCase {
|
|||
* testLoadDataSourceException() method
|
||||
*
|
||||
* @return void
|
||||
* @expectedException MissingDatasourceFileException
|
||||
* @expectedException MissingDatasourceException
|
||||
*/
|
||||
public function testLoadDataSourceException() {
|
||||
$connection = array('classname' => 'NonExistentDataSource', 'filename' => 'non_existent');
|
||||
|
|
|
@ -109,10 +109,10 @@ class HelperCollectionTest extends CakeTestCase {
|
|||
/**
|
||||
* test missinghelper exception
|
||||
*
|
||||
* @expectedException MissingHelperClassException
|
||||
* @expectedException MissingHelperException
|
||||
* @return void
|
||||
*/
|
||||
public function testLoadMissingHelperFile() {
|
||||
public function testLoadMissingHelper() {
|
||||
$result = $this->Helpers->load('ThisHelperShouldAlwaysBeMissing');
|
||||
}
|
||||
|
||||
|
|
|
@ -315,14 +315,14 @@ abstract class ControllerTestCase extends CakeTestCase {
|
|||
$methods = array();
|
||||
}
|
||||
list($plugin, $name) = pluginSplit($component, true);
|
||||
App::uses($name . 'Component', $plugin . 'Controller/Component');
|
||||
if (!class_exists($name . 'Component')) {
|
||||
throw new MissingComponentFileException(array(
|
||||
'file' => $name . 'Component.php',
|
||||
'class' => $name.'Component'
|
||||
$componentClass = $name . 'Component';
|
||||
App::uses($componentClass, $plugin . 'Controller/Component');
|
||||
if (!class_exists($componentClass)) {
|
||||
throw new MissingComponentException(array(
|
||||
'class' => $componentClass
|
||||
));
|
||||
}
|
||||
$_component = $this->getMock($name.'Component', $methods, array(), '', false);
|
||||
$_component = $this->getMock($componentClass, $methods, array(), '', false);
|
||||
$_controller->Components->set($name, $_component);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,24 +16,24 @@
|
|||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
?>
|
||||
<h2><?php echo __d('cake_dev', 'Missing Behavior Class'); ?></h2>
|
||||
<h2><?php echo __d('cake_dev', 'Missing Behavior'); ?></h2>
|
||||
<p class="error">
|
||||
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'The behavior class <em>%s</em> can not be found or does not exist.', $class); ?>
|
||||
<?php echo __d('cake_dev', '%s could not be found.', '<em>' . $class . '</em>'); ?>
|
||||
</p>
|
||||
<p class="error">
|
||||
<p class="error">
|
||||
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'Create the class below in file: %s', APP_DIR . DS . 'Model' . DS . 'Behavior' . DS . Inflector::camelize($file)); ?>
|
||||
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . $class . '</em>', APP_DIR . DS . 'Model' . DS . 'Behavior' . DS . $class . '.php'); ?>
|
||||
</p>
|
||||
<pre>
|
||||
<?php
|
||||
class <?php echo $class;?> extends ModelBehavior {
|
||||
class <?php echo $class; ?> extends ModelBehavior {
|
||||
|
||||
}
|
||||
</pre>
|
||||
<p class="notice">
|
||||
<strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'If you want to customize this error message, create %s', APP_DIR . DS . 'View' . DS . 'Errors' . DS . 'missing_behavior_class.ctp'); ?>
|
||||
<?php echo __d('cake_dev', 'If you want to customize this error message, create %s', APP_DIR . DS . 'View' . DS . 'Errors' . DS . 'missing_behavior.ctp'); ?>
|
||||
</p>
|
||||
|
||||
<?php echo $this->element('exception_stack_trace'); ?>
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake.libs.view.templates.errors
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
?>
|
||||
<h2><?php echo __d('cake_dev', 'Missing Behavior File'); ?></h2>
|
||||
<p class="error">
|
||||
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'The Behavior file %s can not be found or does not exist.', APP_DIR . DS . 'Model' . DS . 'Behavior' . DS . Inflector::camelize($file)); ?>
|
||||
</p>
|
||||
<p class="error">
|
||||
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'Create the class below in file: %s', APP_DIR . DS . 'Model' . DS . 'Behavior' . DS . Inflector::camelize($file)); ?>
|
||||
</p>
|
||||
<pre>
|
||||
<?php
|
||||
class <?php echo $class;?> extends ModelBehavior {
|
||||
|
||||
}
|
||||
</pre>
|
||||
<p class="notice">
|
||||
<strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'If you want to customize this error message, create %s', APP_DIR . DS . 'View' . DS . 'Errors' . DS . 'missing_behavior_file.ctp'); ?>
|
||||
</p>
|
||||
|
||||
<?php echo $this->element('exception_stack_trace'); ?>
|
|
@ -16,24 +16,24 @@
|
|||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
?>
|
||||
<h2><?php echo __d('cake_dev', 'Missing Component File'); ?></h2>
|
||||
<h2><?php echo __d('cake_dev', 'Missing Component'); ?></h2>
|
||||
<p class="error">
|
||||
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'The component file was not found.'); ?>
|
||||
<?php echo __d('cake_dev', '%s could not be found.', '<em>' . $class . '</em>'); ?>
|
||||
</p>
|
||||
<p class="error">
|
||||
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'Create the class %s in file: %s', '<em>' . $class . '</em>', APP_DIR . DS . 'Controller' . DS . 'Component' . DS . Inflector::camelize($file)); ?>
|
||||
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . $class . '</em>', APP_DIR . DS . 'Controller' . DS . 'Component' . DS . $class . '.php'); ?>
|
||||
</p>
|
||||
<pre>
|
||||
<?php
|
||||
class <?php echo $class;?> extends Component {<br />
|
||||
class <?php echo $class; ?> extends Component {
|
||||
|
||||
}
|
||||
</pre>
|
||||
<p class="notice">
|
||||
<strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'If you want to customize this error message, create %s', APP_DIR . DS . 'View' . DS . 'Errors' . DS . 'missing_component_file.ctp'); ?>
|
||||
<?php echo __d('cake_dev', 'If you want to customize this error message, create %s', APP_DIR . DS . 'View' . DS . 'Errors' . DS . 'missing_component.ctp'); ?>
|
||||
</p>
|
||||
|
||||
<?php echo $this->element('exception_stack_trace'); ?>
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake.libs.view.templates.errors
|
||||
* @since CakePHP(tm) v 0.10.0.1076
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
?>
|
||||
<h2><?php echo __d('cake_dev', 'Missing Component Class'); ?></h2>
|
||||
<p class="error">
|
||||
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'Component class %1$s was not found.', '<em>' . $class . '</em>'); ?>
|
||||
</p>
|
||||
<p class="error">
|
||||
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'Create the class %s in file: %s', '<em>' . $class . '</em>', APP_DIR . DS . 'Controller' . DS . 'Component' . DS . Inflector::camelize($file)); ?>
|
||||
</p>
|
||||
<pre>
|
||||
<?php
|
||||
class <?php echo $class;?> extends Component {<br />
|
||||
|
||||
}
|
||||
</pre>
|
||||
<p class="notice">
|
||||
<strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'If you want to customize this error message, create %s', APP_DIR . DS . 'View' . DS . 'Errors' . DS . 'missing_component_class.ctp'); ?>
|
||||
</p>
|
||||
|
||||
<?php echo $this->element('exception_stack_trace'); ?>
|
|
@ -27,7 +27,7 @@
|
|||
</p>
|
||||
<pre>
|
||||
<?php
|
||||
class <?php echo $controller;?> extends AppController {
|
||||
class <?php echo $controller; ?> extends AppController {
|
||||
|
||||
}
|
||||
</pre>
|
||||
|
|
|
@ -16,14 +16,14 @@
|
|||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
?>
|
||||
<h2><?php echo __d('cake_dev', 'Missing Datasource Class'); ?></h2>
|
||||
<h2><?php echo __d('cake_dev', 'Missing Datasource'); ?></h2>
|
||||
<p class="error">
|
||||
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'Datasource class %1$s was not found.', '<em>' . $class . '</em>'); ?>
|
||||
<?php echo __d('cake_dev', 'Datasource class %s could not be found.', '<em>' . $class . '</em>'); ?>
|
||||
</p>
|
||||
<p class="notice">
|
||||
<strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'If you want to customize this error message, create %s', APP_DIR . DS . 'View' . DS . 'Errors' . DS . 'missing_datasource_file.ctp'); ?>
|
||||
<?php echo __d('cake_dev', 'If you want to customize this error message, create %s', APP_DIR . DS . 'View' . DS . 'Errors' . DS . 'missing_datasource.ctp'); ?>
|
||||
</p>
|
||||
|
||||
<?php echo $this->element('exception_stack_trace'); ?>
|
|
@ -16,24 +16,24 @@
|
|||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
?>
|
||||
<h2><?php echo __d('cake_dev', 'Missing Helper Class'); ?></h2>
|
||||
<h2><?php echo __d('cake_dev', 'Missing Helper'); ?></h2>
|
||||
<p class="error">
|
||||
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'The helper class <em>%s</em> can not be found or does not exist.', $class); ?>
|
||||
<?php echo __d('cake_dev', '%s could not be found.', '<em>' . $class . '</em>'); ?>
|
||||
</p>
|
||||
<p class="error">
|
||||
<p class="error">
|
||||
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'Create the class below in file: %s', APP_DIR . DS . 'View' . DS . 'Helper' . DS . Inflector::camelize($file)); ?>
|
||||
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . $class . '</em>', APP_DIR . DS . 'View' . DS . 'Helper' . DS . $class . '.php'); ?>
|
||||
</p>
|
||||
<pre>
|
||||
<?php
|
||||
class <?php echo $class;?> extends AppHelper {
|
||||
class <?php echo $class; ?> extends AppHelper {
|
||||
|
||||
}
|
||||
</pre>
|
||||
<p class="notice">
|
||||
<strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'If you want to customize this error message, create %s', APP_DIR . DS . 'View' . DS . 'Errors' . DS . 'missing_helper_class.ctp'); ?>
|
||||
<?php echo __d('cake_dev', 'If you want to customize this error message, create %s', APP_DIR . DS . 'View' . DS . 'Errors' . DS . 'missing_helper.ctp'); ?>
|
||||
</p>
|
||||
|
||||
<?php echo $this->element('exception_stack_trace'); ?>
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake.libs.view.templates.errors
|
||||
* @since CakePHP(tm) v 0.10.0.1076
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
?>
|
||||
<h2><?php echo __d('cake_dev', 'Missing Helper File'); ?></h2>
|
||||
<p class="error">
|
||||
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'The helper file %s can not be found or does not exist.', APP_DIR . DS . 'View' . DS . 'Helper' . DS . Inflector::camelize($file)); ?>
|
||||
</p>
|
||||
<p class="error">
|
||||
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'Create the class below in file: %s', APP_DIR . DS . 'View' . DS . 'Helper' . DS . Inflector::camelize($file)); ?>
|
||||
</p>
|
||||
<pre>
|
||||
<?php
|
||||
class <?php echo $class;?> extends AppHelper {
|
||||
|
||||
}
|
||||
</pre>
|
||||
<p class="notice">
|
||||
<strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong>
|
||||
<?php echo __d('cake_dev', 'If you want to customize this error message, create %s', APP_DIR . DS . 'View' . DS . 'Errors' . DS . 'missing_helper_file.ctp'); ?>
|
||||
</p>
|
||||
|
||||
<?php echo $this->element('exception_stack_trace'); ?>
|
|
@ -55,7 +55,7 @@ class HelperCollection extends ObjectCollection {
|
|||
* @param string $helper Helper name to load
|
||||
* @param array $settings Settings for the helper.
|
||||
* @return Helper A helper object, Either the existing loaded helper or a new one.
|
||||
* @throws MissingHelperFileException, MissingHelperClassException when the helper could not be found
|
||||
* @throws MissingHelperException when the helper could not be found
|
||||
*/
|
||||
public function load($helper, $settings = array()) {
|
||||
if (is_array($settings) && isset($settings['className'])) {
|
||||
|
@ -73,9 +73,8 @@ class HelperCollection extends ObjectCollection {
|
|||
$helperClass = $name . 'Helper';
|
||||
App::uses($helperClass, $plugin . 'View/Helper');
|
||||
if (!class_exists($helperClass)) {
|
||||
throw new MissingHelperClassException(array(
|
||||
'class' => $helperClass,
|
||||
'file' => $helperClass . '.php'
|
||||
throw new MissingHelperException(array(
|
||||
'class' => $helperClass
|
||||
));
|
||||
}
|
||||
$this->_loaded[$alias] = new $helperClass($this->_View, $settings);
|
||||
|
|
Loading…
Reference in a new issue