First pass at making MissingView/MissingLayout exceptions show all

paths.

Showing all the paths a template file could be located help expose
developers to the view path cascade and helps ensure we don't tell
people the wrong place to put a view file.

Refs #3712
This commit is contained in:
mark_story 2014-06-17 16:30:50 -04:00
parent 7ea6626a15
commit e548dfcaea
3 changed files with 28 additions and 2 deletions

View file

@ -25,6 +25,19 @@
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Confirm you have created the file: %s', '<em>' . h($file) . '</em>'); ?>
</p>
<p>
You should create "<?php echo h($file); ?>" in one of he following paths:
</p>
<ul>
<?php
$paths = $this->_paths($this->plugin);
foreach ($paths as $path):
echo sprintf('<li>%s%s%s</li>', h($path), DS, h($file));
endforeach;
?>
</ul>
<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_layout.ctp'); ?>

View file

@ -25,6 +25,19 @@
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Confirm you have created the file: %s', h($file)); ?>
</p>
<p>
You should create "<?php echo h($file); ?>" in one of he following paths:
</p>
<ul>
<?php
$paths = $this->_paths($this->plugin);
foreach ($paths as $path):
echo sprintf('<li>%s%s%s</li>', h($path), DS, h($file));
endforeach;
?>
</ul>
<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_view.ctp'); ?>

View file

@ -1019,7 +1019,7 @@ class View extends Object {
}
}
}
throw new MissingViewException(array('file' => $defaultPath . $name . $this->ext));
throw new MissingViewException(array('file' => $name . $this->ext));
}
/**
@ -1072,7 +1072,7 @@ class View extends Object {
}
}
}
throw new MissingLayoutException(array('file' => $paths[0] . $file . $this->ext));
throw new MissingLayoutException(array('file' => $file . $this->ext));
}
/**