Skip to content

Commit

Permalink
Small fixups in templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Mar 18, 2014
1 parent ad8045c commit 8f72aec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Console/Templates/default/classes/entity.ctp
Expand Up @@ -7,6 +7,7 @@ use Cake\ORM\Entity;
* <?= $name ?> Entity.
*/
class <?= $name ?> extends Entity {

<?php if (!empty($fields)): ?>
<?php
$fields = array_map(function($el) { return "'$el'"; }, $fields);
Expand Down
5 changes: 3 additions & 2 deletions src/Console/Templates/default/classes/table.ctp
Expand Up @@ -78,11 +78,12 @@ $key = array_map(function($el) { return "'$el'"; }, (array)$primaryKey);
public function validationDefault(Validator $validator) {
$validator
<?php foreach ($validation as $field => $rule): ?>
->add('<?= $field ?>', 'valid', ['rule' => '<?= $rule['rule'] ?>'])
->add('<?= $field ?>', 'valid', ['rule' => '<?= $rule['rule'] ?>'])
<?php if ($rule['allowEmpty']): ?>
->allowEmpty('<?= $field ?>')
->allowEmpty('<?= $field ?>')
<?php endif ?>
<?php endforeach ?>;
return $validator;
}
<?php endif ?>

Expand Down

0 comments on commit 8f72aec

Please sign in to comment.