# |
Dec 13th 2017, 17:50 |
bravo-kernel |
And.. if you are using the the .json extension.. you should not, the header is enough |
# |
Dec 13th 2017, 17:49 |
bravo-kernel |
Does your Articles table and entity exist? |
# |
Dec 13th 2017, 17:44 |
leon |
File uploaded https://cakesf.slack.com/files/U1G9WJU4Q/F8DM861ND/-.php / https://slack-files.com/T053DPNCM-F8DM861ND-c6f2ba9e6a |
# |
Dec 13th 2017, 17:43 |
leon |
Hey. I read your tutorial. Thanks for that. When I implement it it works with crud, but when i try it with crud-json-api Plugin, i always get an error: |
# |
Dec 13th 2017, 17:42 |
bravo-kernel |
@Leon Ofcourse, 3.5.7 no problem at all |
# |
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 |