# |
Mar 8th 2018, 16:23 |
lorenzo |
in theory the format should be dependent on the browser’s locale |
# |
Mar 8th 2018, 16:22 |
ricksaccous |
in view always divide number by 100 |
# |
Mar 8th 2018, 16:22 |
ricksaccous |
just take out all , or . and multiply number by 100 |
# |
Mar 8th 2018, 16:22 |
ricksaccous |
store number as int and then use step=any in the textfield |
# |
Mar 8th 2018, 16:20 |
jojomartius |
but what i dont like is that i need to know how the user will enter its number... if the german user uses an english format, it returns 0 and the otherway around ;) |
# |
Mar 8th 2018, 16:14 |
jojomartius |
good idea ;)) thanks |
# |
Mar 8th 2018, 16:05 |
lorenzo |
@jojomartius my suggestion would be to either use a beforeMarshal callback or use a custom database type |
# |
Mar 8th 2018, 16:04 |
jojomartius |
;) sounds like a quite good solution ;) and if we do this in the model directly while setting the value it should happen "automatically" ;) |
# |
Mar 8th 2018, 16:03 |
lorenzo |
you can maybe read the locale from the user agent string of the user, and pre-process the inputs with that function |
# |
Mar 8th 2018, 16:03 |
lorenzo |
@jojomartius https://api.cakephp.org/3.5/class-Cake.I18n.Number.html#_parseFloat |
# |
Mar 8th 2018, 16:02 |
jojomartius |
Hey there, I'm using cake 3.x and had issues with the formhelper or lets call in number inputs. Is there an official way to correct decimal numbers (from number inputs) comming from IE with commas as decimal seperator in real floats? |
# |
Mar 8th 2018, 16:00 |
lorenzo |
find StatementDecorator in our github repo |
# |
Mar 8th 2018, 15:59 |
neon1024 |
Wow, quite a bit then! Thanks, I’ll have a read of the code an see if a more concrete implementation helps get it into my brain |
# |
Mar 8th 2018, 15:58 |
lorenzo |
formatResults is a decorator of the result set |
# |
Mar 8th 2018, 15:58 |
lorenzo |
the code that converts the rows to entities is a decorator of the statement… |
# |
Mar 8th 2018, 15:58 |
lorenzo |
the code that casts the results to the right type (int, dates…) is a decorator of the statement |
# |
Mar 8th 2018, 15:57 |
lorenzo |
the statement object is a decorator for pdo statement |
# |
Mar 8th 2018, 15:57 |
lorenzo |
I sued decorator for a bunch of stuff, but where it is more obvious is in the result set |
# |
Mar 8th 2018, 15:56 |
neon1024 |
@lorenzo The decorator in the ORM, is that for the query building, the sql, or the entities? I’m unsure |
# |
Mar 8th 2018, 15:55 |
ricksaccous |
heh |
# |
Mar 8th 2018, 15:55 |
ricksaccous |
so no issue |
# |
Mar 8th 2018, 15:55 |
ricksaccous |
i see, so the issue with the docs is actually probably a difference in version between me and repo rather than a bug |
# |
Mar 8th 2018, 15:55 |
em. |
ok, thx! |
# |
Mar 8th 2018, 15:55 |
lorenzo |
haha |
# |
Mar 8th 2018, 15:55 |
lorenzo |
@em. that is a really bad error message, it actaully should say “the table you are trying to use does not exist. please check your database or for typos” |
# |
Mar 8th 2018, 15:55 |
savant |
my favorite pattern is to write code and have @lorenzo write the tests |
# |
Mar 8th 2018, 15:54 |
lorenzo |
decorator is one of my favorite patterns :slightly_smiling_face: |
# |
Mar 8th 2018, 15:54 |
em. |
This is something new… “Cannot describe sessions. It has 0 columns.” |
# |
Mar 8th 2018, 15:54 |
neon1024 |
Or try `composer outdated` |
# |
Mar 8th 2018, 15:54 |
ricksaccous |
ok |
# |
Mar 8th 2018, 15:54 |
ricksaccous |
ahhhh |
# |
Mar 8th 2018, 15:54 |
neon1024 |
I’d have a look in your composer.lock |
# |
Mar 8th 2018, 15:54 |
savant |
its currently 3.8.0 |
# |
Mar 8th 2018, 15:54 |
savant |
check the releases |
# |
Mar 8th 2018, 15:53 |
ricksaccous |
how do i know the version of cakephpupload that's on your repo? |
# |
Mar 8th 2018, 15:50 |
neon1024 |
@savant I remember that big Jose demonstrated the Command pattern and DI container using Pimple at the Cakefest workshops, but I didn’t take enough notes at the time |
# |
Mar 8th 2018, 15:46 |
neon1024 |
I didn’t read that one yet. `Facade::read(false)` |
# |
Mar 8th 2018, 15:45 |
neon1024 |
I don’t know if some of the Registry stuff counts as a Facade |
# |
Mar 8th 2018, 15:45 |
neon1024 |
Service locator pattern is in there as well as the Repository pattern. Those are the ones I know of |
# |
Mar 8th 2018, 15:45 |
savant |
like we support DI (just dont have a container and everyone gets really upset if you dont have a super-global to contain your stuff) |
# |
Mar 8th 2018, 15:44 |
neon1024 |
My focus this year is trying to work slower and invest more in code quality, I think patterns can help with that to some degree |