# |
Dec 13th 2017, 17:41 |
leon |
Hello. Is somebody here who succesfully used FriendsOfCake/crud-json-api with cake 3.5? |
# |
Dec 13th 2017, 17:19 |
meowcate |
The cookbook says a lot about "how to get others languages", I though that see easy, but there is not so much about "how to come back to the original after that". |
# |
Dec 13th 2017, 17:18 |
meowcate |
So my defaultLocale is currently *en_US*. If I call `I18n::setLocale('en_US');`, it should use the content of my `articles` table, and not checking the `i18n` one ? |
# |
Dec 13th 2017, 17:16 |
meowcate |
@hmic `defaultLocale`, I see, thanks. First time I'm working on a multilang app. |
# |
Dec 13th 2017, 16:57 |
hmic |
meowcate: App.language probably? |
# |
Dec 13th 2017, 16:56 |
meowcate |
I see this example from the Translate behavior in cookbook, `I18n::setLocale('en'); // reset for illustration`, but I have no idea where this `'en'` comes from. |
# |
Dec 13th 2017, 16:56 |
kailas |
@hmic - nevermind, I was looking at the wrong entity. you were right! it was the accessible bit.. |
# |
Dec 13th 2017, 16:53 |
meowcate |
I have a question about the Translate behavior. I see you can use `I18n::setLocale('es');` for example to get next results translated, but how can I restore the default language ? The original datas from my `Articles` table, which is not in there `i18n` table, how can I go back to it ? |
# |
Dec 13th 2017, 16:52 |
kailas |
wait, ok, in the entity , _accessible[‘*’=>true]. however, when i look at the $x3order object at runtime, there’s a ‘accessible’ element, and ‘requested_delivery_date’ is not in the array |
# |
Dec 13th 2017, 16:50 |
kailas |
ok, will try deleting the cache |
# |
Dec 13th 2017, 16:49 |
kailas |
hrm |
# |
Dec 13th 2017, 16:49 |
hmic |
- i suppose the requested_delivery_date field has been added lately |
# |
Dec 13th 2017, 16:49 |
hmic |
if so, delete the orm cache |
# |
Dec 13th 2017, 16:49 |
hmic |
check the patched entity before saving, is the data in there? |
# |
Dec 13th 2017, 16:49 |
hmic |
thats the typical problem with fields beeing ignored by patchentity |
# |
Dec 13th 2017, 16:48 |
kailas |
I can’t figure out why date would work and the other datetime wouldn’t work… |
# |
Dec 13th 2017, 16:48 |
kailas |
well, ‘*’ i true, and only ‘id’ is false |
# |
Dec 13th 2017, 16:47 |
kailas |
yes |
# |
Dec 13th 2017, 16:47 |
kailas |
lemme chck |
# |
Dec 13th 2017, 16:47 |
hmic |
check the entity class |
# |
Dec 13th 2017, 16:47 |
kailas |
I don’t see any validation errors either, after creating the entity |
# |
Dec 13th 2017, 16:47 |
hmic |
kailas: is the property accessible? |
# |
Dec 13th 2017, 16:46 |
kailas |
I have a model X3Orders with two datetime fields, date and requested_delivery_date. when patchEntity with [‘date’=>’2017-01-01 01:00,‘requested_delivery_date’=>‘2017-01-01 01:00’], the value for ->date is set, but not for ->requested_delivery_date . i don’t have useLocaleParser set. any ideas what could be going on? |
# |
Dec 13th 2017, 15:44 |
salewilliam09 |
Difficult for customize QueryBuilder. |
# |
Dec 13th 2017, 15:42 |
salewilliam09 |
@hmic (IRC) Yes, we need change "alias" for Tags. |
# |
Dec 13th 2017, 15:39 |
hmic |
salewilliam09: alias them differently |
# |
Dec 13th 2017, 15:31 |
slackebot |
as pt WHERE pt.tag_id IN(Tags.id) OR pt.tag_id IN (SELECT id FROM tags t WHERE t.parent_id = Tags.id)) > 0 ORDER BY Tags.order_NO asc We changed alias table Tags is tags,t,ect..., after all alias replace only one "tags" or "t" Thanks, |
# |
Dec 13th 2017, 15:31 |
salewilliam09 |
Dear all, We have small issue under Cake\ORM\Query, how to execute 2 or 3 same table in once QueryBuilder. Original query: SELECT Tags.id AS "Tags__id", Tags.value AS "Tags__value", ( SELECT count(pt.paper_id) FROM paper_tags as pt WHERE pt.tag_id IN(Tags.id) OR pt.tag_id IN (SELECT id FROM tags t WHERE t.parent_id = Tags.id)) as totalTags FROM tags tags WHERE (Tags.parent_id) IS NULL AND ( SELECT count(pt.paper_id) FROM paper_tags |
# |
Dec 13th 2017, 15:19 |
dereuromark |
keep it simple, constants make it harder to test as once defined you cant get rid of it, so use them only if even in tests they cannot change ever |
# |
Dec 13th 2017, 15:19 |
dereuromark |
meowcate: in 2.x ages I also nano-optimized too much here, the usage is the same in total time, even if used 1000x times there is no real issue to measure compared to the rest of the framework request cycle. |
# |
Dec 13th 2017, 14:55 |
meowcate |
I'll give it a try then |
# |
Dec 13th 2017, 14:49 |
hmic |
you can have the config used in classes at initialize time, like *lots* of classes in cakephp do |
# |
Dec 13th 2017, 14:45 |
meowcate |
So far I always use Configure, because I didn't have to call it often. Here, it could make the code harder to read. |
# |
Dec 13th 2017, 14:43 |
meowcate |
I'll have to use those values many times. That's why I think it's better to use constants than calling Configure::read() each time. |
# |
Dec 13th 2017, 14:41 |
hmic |
there are very very few instances where you would really want a constant |
# |
Dec 13th 2017, 14:40 |
hmic |
i'd say cleaner would be using Configure, not constants |
# |
Dec 13th 2017, 14:40 |
meowcate |
Thanks for the answer, an new file seems to be cleaner then |
# |
Dec 13th 2017, 14:36 |
hmic |
or rather create your own file and include it from bootstrap.php only |
# |
Dec 13th 2017, 14:35 |
hmic |
if thats not what you want, bootstrap.php is the place to put it for sure |
# |
Dec 13th 2017, 14:35 |
hmic |
meowcate: configure::read() and set the info up in app.php? |
# |
Dec 13th 2017, 14:34 |
jkpatel291289 |
may be you can use bootstrap.php |