Skip to content

Commit

Permalink
make the filename more easier to associate with the template
Browse files Browse the repository at this point in the history
otherwise, in the case of an error you have to work out which template
is causing the error only from the pre-processed template contents
  • Loading branch information
AD7six committed Nov 14, 2014
1 parent c65a0a2 commit e6f2d49
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/View/BakeView.php
Expand Up @@ -14,6 +14,8 @@
*/
namespace Cake\View;

use Cake\Utility\Inflector;

class BakeView extends View {

/**
Expand Down Expand Up @@ -90,7 +92,7 @@ protected function _evaluate($viewFile, $dataForView) {
$viewString = str_replace(array_keys($templatify), array_values($templatify), $viewString);
$viewString = preg_replace('/<\?=(.*)\?>\n(.)/', "<?=$1?>\n\n$2", $viewString);

$this->__viewFile = TMP . $randomString . '.php';
$this->__viewFile = TMP . Inflector::slug(str_replace(ROOT, '', $viewFile)) . '.php';
file_put_contents($this->__viewFile, $viewString);

unset($randomString, $templatify, $viewFile, $viewString);
Expand Down
7 changes: 7 additions & 0 deletions src/View/Helper/BakeHelper.php
Expand Up @@ -85,4 +85,11 @@ public function stringifyList($list, $options = []) {
return $start . implode($join, $wrapped) . $end;
}

public function aliasExtractor($modelObj, $assoc) {
$extractor = function ($val) {
return $val->target()->alias();
};

return array_map($extractor, $modelObj->associations()->type($assoc));
}
}

0 comments on commit e6f2d49

Please sign in to comment.