Skip to content

3.5.0

Choose a tag to compare

@dereuromark dereuromark released this 05 Apr 09:46
· 80 commits to master since this release
c851a87

Improvements

Shimmed CakePHP 5.3 number helper functionality regarding "null / empty".

In your AppView.php:

$this->loadHelper('Shim.Number');

instead of the core one.

You have now the empty functionality of CakePHP 5.3+ in your Number helper:

  • format()
  • currency()

Instead of ternary checks you can pass your DB values directly, it will print out
an empty string (or defined default string) where needed.

echo $this->Number->format($entity->value);
// or
echo $this->Number->format($entity->value, ['default' => '-']);

and

echo $this->Number->currency($entity->value);
// or
echo $this->Number->currency($entity->value, ['default' => '-']);

This aims to provide forward compatibility.