# |
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 |
# |
Dec 13th 2017, 14:28 |
meowcate |
If I want to define some constants for all my app, what would be the right place to add it ? the only file in /config that have constants is paths.php, but I prefer to keep... only paths in it. |
# |
Dec 13th 2017, 13:23 |
jkpatel291289 |
on my form |
# |
Dec 13th 2017, 13:22 |
jkpatel291289 |
so i createcd this separate acxtion to call within the ajax code |
# |
Dec 13th 2017, 13:22 |
jkpatel291289 |
i have a from on which i want to add option to select trucks.. |
# |
Dec 13th 2017, 13:19 |
hmic |
now you dont even need an action for it, but can decide what to do on the request type in the very same action displaying the control - just saying |
# |
Dec 13th 2017, 13:18 |
hmic |
looks good |
# |
Dec 13th 2017, 13:17 |
jkpatel291289 |
this worked, thanks |
# |
Dec 13th 2017, 13:17 |
jkpatel291289 |
return $this->response->withType('application/json') ->withStringBody(json_encode($resultsArr)); |
# |
Dec 13th 2017, 13:14 |
hmic |
cant remember |
# |
Dec 13th 2017, 13:14 |
hmic |
yeah, might be another function name, stringBody or something |
# |
Dec 13th 2017, 13:13 |
jkpatel291289 |
got this error "Argument 1 passed to Cake\Http\Response::withBody() must implement interface Psr\Http\Message\StreamInterface, string given, called in D:\xampp\htdocs\agnitrans\src\Controller\TrucksController.php on line 124 |
# |
Dec 13th 2017, 13:12 |
hmic |
return $this->response->withHeader('Content-Type', 'application/json')->withBody(json_encode($resultsArr)); |
# |
Dec 13th 2017, 13:10 |
jkpatel291289 |
i am newbi.. can you show me how? i am trying to create autocomplete controll |
# |
Dec 13th 2017, 13:10 |
hmic |
like i said: set the data to the response object and return it! |
# |
Dec 13th 2017, 13:09 |
jkpatel291289 |
so what you suggest? |
# |
Dec 13th 2017, 13:09 |
jkpatel291289 |
ohh.. |
# |
Dec 13th 2017, 13:09 |
hmic |
https://gist.github.com/jaynarayan89/0eec17e993dad9c4ceb0567014ca764b#file-gistfile1-txt-L13 |
# |
Dec 13th 2017, 13:08 |
jkpatel291289 |
:,) |
# |
Dec 13th 2017, 13:08 |
jkpatel291289 |
check the gist..:point_up: |
# |
Dec 13th 2017, 13:08 |
hmic |
:P |
# |
Dec 13th 2017, 13:08 |
hmic |
show me the updated code without echo |