Skip to content

Commit

Permalink
Not showing binary columns in any baked templates, fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Sep 17, 2014
1 parent f4ca563 commit ab13ef8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/Template/Bake/default/views/form.ctp
Expand Up @@ -14,6 +14,10 @@
*/
use Cake\Utility\Inflector;

$fields = collection($fields)
->filter(function($field) use ($schema) {
return $schema->columnType($field) !== 'binary';
});
?>
<div class="actions columns large-2 medium-3">
<h3><?= "<?= __('Actions') ?>" ?></h3>
Expand Down
5 changes: 4 additions & 1 deletion src/Template/Bake/default/views/view.ctp
Expand Up @@ -30,6 +30,9 @@ $associationFields = collection($fields)
}, []);

$groupedFields = collection($fields)
->filter(function($field) use ($schema) {
return $schema->columnType($field) !== 'binary';
})
->groupBy(function($field) use ($schema, $associationFields) {
$type = $schema->columnType($field);
if (isset($associationFields[$field])) {
Expand All @@ -53,7 +56,7 @@ $groupedFields += ['number' => [], 'string' => [], 'boolean' => [], 'date' => []
<?php
$pk = "\${$singularVar}->{$primaryKey[0]}";

echo "\t\t<li><?= \$this->Html->link(__('Edit " . $singularHumanName ."'), ['action' => 'edit', {$pk}]) ?> </li>\n";
echo "\t\t<li><?= \$this->Html->link(__('Edit " . $singularHumanName . "'), ['action' => 'edit', {$pk}]) ?> </li>\n";
echo "\t\t<li><?= \$this->Form->postLink(__('Delete " . $singularHumanName . "'), ['action' => 'delete', {$pk}], ['confirm' => __('Are you sure you want to delete # %s?', {$pk})]) ?> </li>\n";
echo "\t\t<li><?= \$this->Html->link(__('List " . $pluralHumanName . "'), ['action' => 'index']) ?> </li>\n";
echo "\t\t<li><?= \$this->Html->link(__('New " . $singularHumanName . "'), ['action' => 'add']) ?> </li>\n";
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Shell/Task/ViewTaskTest.php
Expand Up @@ -289,7 +289,7 @@ public function testGetPathPlugin() {
public function testGetContent() {
$vars = array(
'modelClass' => 'TestViewModel',
'schema' => [],
'schema' => TableRegistry::get('ViewTaskComments')->schema(),
'primaryKey' => ['id'],
'displayField' => 'name',
'singularVar' => 'testViewModel',
Expand Down Expand Up @@ -320,7 +320,7 @@ public function testGetContent() {
public function testGetContentWithRoutingPrefix() {
$vars = array(
'modelClass' => 'TestViewModel',
'schema' => [],
'schema' => TableRegistry::get('ViewTaskComments')->schema(),
'primaryKey' => ['id'],
'displayField' => 'name',
'singularVar' => 'testViewModel',
Expand Down

0 comments on commit ab13ef8

Please sign in to comment.