# |
Oct 2nd 2016, 01:25 |
ndm |
http://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#filtering-by-associated-data |
# |
Oct 2nd 2016, 01:25 |
ndm |
@waspinator Depends on the type of association... for `hasOne`/`belongsTo` you could use the `INNER` join type (contain configs accept a `joinType` option), apart from that, `innerJoinWith()`/`matching()` works for all types. |
# |
Oct 2nd 2016, 01:17 |
waspinator |
how would you `find()` records where the `contain`ed association is not null? |
# |
Oct 1st 2016, 23:27 |
CoderJon |
Does anyone know how to get bootstrap to work with CakePdf? |
# |
Oct 1st 2016, 17:14 |
mesterjagel |
@hmic okay. I just didnâ??t get an error before I tried to save the individual entity that was failing. Iâ??m most likely doing it wrong in that case :slightly_smiling_face: Thank you :slightly_smiling_face: |
# |
Oct 1st 2016, 17:12 |
hmic |
the error will not be in the main entity, but the related one of which the save failed |
# |
Oct 1st 2016, 17:11 |
hmic |
mesterjagel: from the entity, like without |
# |
Oct 1st 2016, 16:58 |
mesterjagel |
Hey guys, when is there a way to get error messages when saving a with associations and something in the associated data fails? |
# |
Oct 1st 2016, 16:38 |
ra7bi |
:+1: |
# |
Oct 1st 2016, 16:37 |
hmic |
both are free for use and download to process in a format you like |
# |
Oct 1st 2016, 16:37 |
ra7bi |
Thanks @hmic |
# |
Oct 1st 2016, 16:37 |
hmic |
this too: http://cldr.unicode.org/translation/country-names |
# |
Oct 1st 2016, 16:36 |
hmic |
this is a quite official list with countries and their english names: http://data.okfn.org/data/core/country-list |
# |
Oct 1st 2016, 16:36 |
ra7bi |
Okay , i thought there is an automatic way |
# |
Oct 1st 2016, 16:35 |
hmic |
ra7bi: you need a list of countrie, maybe even translations?! it's quite static data, still a lot. you could keep them in a db table or have a file with them to load in |
# |
Oct 1st 2016, 16:33 |
ra7bi |
what is the best way to create nationality dropdown list , is there a plugin ? instate of writing all countries manually |
# |
Oct 1st 2016, 16:32 |
ra7bi |
hello |
# |
Oct 1st 2016, 16:17 |
rsadza |
I didn't know about widgets yet, this is great :slightly_smiling_face: |
# |
Oct 1st 2016, 16:16 |
hmic |
additionally, you have a fully working example on it in the core: the datetime datatype and widget |
# |
Oct 1st 2016, 16:15 |
hmic |
it makes it easier to marshall the data and utilizing a widget |
# |
Oct 1st 2016, 16:14 |
hmic |
welcome!# |
# |
Oct 1st 2016, 16:14 |
rsadza |
cool! |
# |
Oct 1st 2016, 16:14 |
rsadza |
Thanks :slightly_smiling_face: I didn't even consider submitting the entire field as an array (I was thinking about having [price] and [price_unit]) |
# |
Oct 1st 2016, 16:13 |
hmic |
if you provide a custom widget, you might get away with that alone, as the formhelper would know the field type (money) and choose a coresponging widget automatically itself! |
# |
Oct 1st 2016, 16:13 |
hmic |
extending the form helper to output a currency field type is a good idea to ease the usage, sure |
# |
Oct 1st 2016, 16:12 |
hmic |
still, you only have one place to deal with that: when marshalling data to the entity. |
# |
Oct 1st 2016, 16:11 |
hmic |
thats it rsadza |
# |
Oct 1st 2016, 16:11 |
hmic |
you would send at least the following data: ['value' => 500, 'currency' => 'EUR', 'unit' => 1 /* 0.01 or 'ct', 'EUR' */] |
# |
Oct 1st 2016, 16:11 |
rsadza |
it currently is, so I am considering adding an input type to the formhelper that adds a hidden field that contains the type (cents / euros) |
# |
Oct 1st 2016, 16:10 |
aro |
anyone seen this? Uncaught Error: Class 'Cake\Error\PHP7ErrorException' not found |
# |
Oct 1st 2016, 16:10 |
hmic |
and your input will not consist of a single field only, will it? |
# |
Oct 1st 2016, 16:09 |
hmic |
you dont change the marshaller |
# |
Oct 1st 2016, 16:09 |
rsadza |
true, the only thing I'm afraid of is that somebody will change an input from cents to euros or vice-versa, and forget to change the marshaller ;) |
# |
Oct 1st 2016, 16:08 |
rsadza |
the Money class keeps the information (Money::EUR(500) = 5.00 euro), but you still need to know if you should multiply by 100 |
# |
Oct 1st 2016, 16:07 |
hmic |
if it's not. you know when to apply it: when marshalling data to the entity. you have a marshaller for the money class anyways, put the code there so it's all in one place and not duplicated whatsoever |
# |
Oct 1st 2016, 16:06 |
hmic |
rsadza: isn't it the money class to take care of all of that details? |
# |
Oct 1st 2016, 15:59 |
rsadza |
Is there some way to do this in a nice way? I think that the best place to define if the value will need to be converted is in the Form helper, so that if we switch the input from euros to eurocents, we don't need to change code elsewhere. |
# |
Oct 1st 2016, 15:57 |
slackebot |
convert it to Money(), we need to parse the input data (e.g. replace comma by dot) and multiply by 100 if its not in cents. If we would do this in the Entity, the Entity would have knowledge of the input type, but we also don' t want to clutter our controller. |
# |
Oct 1st 2016, 15:57 |
rsadza |
I have a question regarding converting request data to an Entity. In our application we are using the moneyphp/money object to represent currencies, to prevent bugs due to multicurrency (e.g. accidentally adding euros to dollars). We are unsure where we should convert the request data to the money object. It would make sense to use the beforeMarshall / setter methods. However: in some cases users can enter money in cents, in some cases in euro |
# |
Oct 1st 2016, 15:51 |
rsadza |
Hi guys! |
# |
Oct 1st 2016, 14:44 |
ndm |
Most probably the better choice in that case. |