# |
May 22nd 2019, 13:42 |
junker37 |
thanks @neon1024 Do you specify the field type in the Table class? |
# |
May 22nd 2019, 13:39 |
neon1024 |
https://book.cakephp.org/3.0/en/orm/database-basics.html#data-types |
# |
May 22nd 2019, 13:39 |
neon1024 |
@junker37 Use the built-in Json data type |
# |
May 22nd 2019, 13:39 |
junker37 |
In my database table, I have a text field which is a json string. In the entity I json_decode the field so that it's an object and not a string. However, I'm running into an issue when trying to save the entity to the database. It is also pulling the json_decoded value and not the string. Is there a way to differentiate between representation and storage of the data? |
# |
May 22nd 2019, 12:50 |
k4t |
thx |
# |
May 22nd 2019, 12:48 |
admad |
@val I dont remember @k4t none that i know of apart from logging them yourself |
# |
May 22nd 2019, 12:46 |
k4t |
@admad is there an easy way to log also catched exceptions? |
# |
May 22nd 2019, 12:45 |
val |
@admad so Log::info behaves differently in cake 3.x than in cake 2.x? |
# |
May 22nd 2019, 12:39 |
admad |
it will be logged only if it reaches the error handler, which wont be the case if you catch it |
# |
May 22nd 2019, 12:37 |
k4t |
hi, maybe a bit stupid question. When I catch an exception in CakePHP it won't be logged, yes? |
# |
May 22nd 2019, 11:54 |
val |
Hi, does `Log::info($message);` in Cake 3.x is supposed to output to the console like `CakeLog::info($message);` does in Cake 2.x? |
# |
May 22nd 2019, 11:10 |
neon1024 |
Creating a custom data type class, the `toDatabase()` method should be casting values right? But the parent Type class method implements the deprecated `_basicTypeCast` method, but if I update my own class with a typehint I get a method signature mismatch. How should I be coping with the deprecation? |
# |
May 22nd 2019, 10:31 |
neon1024 |
From the core I guess? |
# |
May 22nd 2019, 10:31 |
neon1024 |
I’m starting a new plugin, which tests/bootstrap.php file is the one to copy? |
# |
May 22nd 2019, 09:42 |
challgren |
And tendon surgery wa a success!! 95% reattached won’t have feeling in my finger |
# |
May 22nd 2019, 09:41 |
challgren |
@kieran.bowler you probably need some JS help to keep the input to a fixed Length aka `parseFloat($('#price').val()).toFixed(2)` |
# |
May 22nd 2019, 09:23 |
ZoeB |
Hi! Is there a way to log database queries to files in CakePHP 2.0? I'm trying to extend Mysql and its logQuery method to do so, which works in debug mode 2, but I need to do it in live mode 0 as well. |
# |
May 22nd 2019, 09:12 |
kieran.bowler |
:thumbsup: @neon1024 |
# |
May 22nd 2019, 09:11 |
kieran.bowler |
Thanks a lot |
# |
May 22nd 2019, 09:11 |
kieran.bowler |
Brill, that did it :slightly_smiling_face: `<?= $this->Form->control('price', ['type' => 'number', 'label' => ['text' => 'Price <span class="note">£</span>', 'escape' => false], 'step' => '0.10', 'value' => number_format( $product->price, 2)]); ?>` |
# |
May 22nd 2019, 09:09 |
neon1024 |
Yes, number format! Cast to string :flushed: |
# |
May 22nd 2019, 09:09 |
kieran.bowler |
Oooh ok I'll try that |
# |
May 22nd 2019, 09:08 |
kieran.bowler |
Can `number_format` be used in the form helper |
# |
May 22nd 2019, 09:08 |
neon1024 |
`'value' => number_format($item->get('price', 2)` |
# |
May 22nd 2019, 09:08 |
neon1024 |
Or just use `number_format()`? |
# |
May 22nd 2019, 09:08 |
neon1024 |
Also, is the value `1.1` or `1.10`? You might need to cast it to a string instead of float |
# |
May 22nd 2019, 09:08 |
kieran.bowler |
It's not so much that @neon1024 It's more to do with the full 2 decimal place number displaying |
# |
May 22nd 2019, 09:07 |
neon1024 |
Or do you only want rounded to nearest 10p |
# |
May 22nd 2019, 09:07 |
neon1024 |
So it can go up in individual pennies? |
# |
May 22nd 2019, 09:07 |
neon1024 |
@kieran.bowler Did you try `'step' => '0.01'` ? |
# |
May 22nd 2019, 09:04 |
kieran.bowler |
Any help much appreciated |
# |
May 22nd 2019, 09:04 |
kieran.bowler |
There's nothing in https://book.cakephp.org/3.0/en/views/helpers/form.html |
# |
May 22nd 2019, 09:01 |
neon1024 |
Thanks for looking into the issue with bake :clap: |
# |
May 22nd 2019, 09:01 |
neon1024 |
Sorry @dereuromark I must have missed it! |
# |
May 22nd 2019, 09:00 |
dereuromark |
@neon1024 I use it to reach phpstan 7 in some plugins. but also in general as safe handler. |
# |
May 22nd 2019, 08:57 |
kieran.bowler |
The value is `1.10` in the database too |
# |
May 22nd 2019, 08:57 |
kieran.bowler |
I can't find anything in the docs |
# |
May 22nd 2019, 08:57 |
kieran.bowler |
Hi all, I'm having trouble getting this to render as `1.10` Here is the code `<?= $this->Form->control('price', ['type' => 'number', 'label' => ['text' => 'Price <span class="note">£</span>', 'escape' => false], 'step' => '0.10']); ?>` |
# |
May 22nd 2019, 08:56 |
dereuromark |
morning, I send you sth yesterday in terms of controller request handling |
# |
May 22nd 2019, 08:37 |
neon1024 |
Hey everyone :wave: |
# |
May 22nd 2019, 07:54 |
luisdelamo |
@admad right |