# |
Jul 5th 2017, 22:02 |
origamiwork |
Yay, I got it. It was something dumb as I thought. I was only expecting one result in the view, so I wasn't actually iterating on the passed object. (I'll use the fact that I haven't worked with cake in a long time as my excuse :D ) |
# |
Jul 5th 2017, 21:59 |
jeremyharris |
or since they’re so short, gist the action and view and I can give you a second pair of eyes |
# |
Jul 5th 2017, 21:59 |
jeremyharris |
to see what it’s getting. I stand by my suggestion to use debug kit :slightly_smiling_face: |
# |
Jul 5th 2017, 21:58 |
jeremyharris |
you can try debug($this->viewVars) on the view |
# |
Jul 5th 2017, 21:58 |
origamiwork |
the controller is pretty short too. I think it might just be something obvious I'm missing. |
# |
Jul 5th 2017, 21:57 |
jeremyharris |
:) easy to read then |
# |
Jul 5th 2017, 21:56 |
origamiwork |
no, that wouldn't be it, the view is only 4 lines long |
# |
Jul 5th 2017, 21:55 |
jeremyharris |
perhaps you’re overwriting it somewhere earlier in the view? |
# |
Jul 5th 2017, 21:55 |
origamiwork |
hmmm... strange, it wasn't finding anything. It must be some stupid small error I'm making somewhere. |
# |
Jul 5th 2017, 21:55 |
jeremyharris |
if you use debug kit, you can inspect what variables the view is getting |
# |
Jul 5th 2017, 21:55 |
jeremyharris |
yep! that’s usually how it is done |
# |
Jul 5th 2017, 21:54 |
origamiwork |
Should I be able to pass a query object to a view? I was passing the results of the magic findBy function to a view and iterating through them there, but it wasn't able to find any of the variables. |
# |
Jul 5th 2017, 21:53 |
origamiwork |
Awesome, thanks. |
# |
Jul 5th 2017, 21:50 |
jeremyharris |
(for future ref) |
# |
Jul 5th 2017, 21:50 |
jeremyharris |
if you want to inspect the results without iterating through them, you can use ->toArray() |
# |
Jul 5th 2017, 21:49 |
origamiwork |
@slackebot Thanks for the info, I was actually using that link to write my code. I think what you said about iterating is working. When I loop through the results using foreach, it seems to have the correct data. |
# |
Jul 5th 2017, 21:38 |
jeremyharris |
more info: https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#dynamic-finders |
# |
Jul 5th 2017, 21:37 |
jeremyharris |
to execute, iterate through the results like you would a regular find() query, or use first(), all(), etc |
# |
Jul 5th 2017, 21:37 |
jeremyharris |
perhaps what you’re seeing is the debug output, which shows information about the query but doesn’t actually execute it |
# |
Jul 5th 2017, 21:36 |
jeremyharris |
origamiwork it will return a query object |
# |
Jul 5th 2017, 21:35 |
origamiwork |
Hello everybody, should a magic findBy function return the SQL it's trying to execute? I have a field in a table called urlname, and when I run the function findByUrlname($url_name), it returns "SELECT Pg.id AS `Pg__id`, Pg.urlname AS `Pg__urlname`, ... WHERE Pg.urlname = :c0" |
# |
Jul 5th 2017, 20:57 |
gutts |
wouldn't I have to use call_user_func if I did that? or is there some tricky way of doing it |
# |
Jul 5th 2017, 20:56 |
gutts |
since it accepts a closure |
# |
Jul 5th 2017, 20:56 |
gutts |
hm, i need the same function to pass to notEmpty. is there an easy way to reference it if I define it in my model table? |
# |
Jul 5th 2017, 20:00 |
jarard01 |
ohh i got it - very nice |
# |
Jul 5th 2017, 19:58 |
jarard01 |
is there a cake way of converting a date to datetime, ie 1 Jul 2017 to '2017-07-01 00:00:00' |
# |
Jul 5th 2017, 19:57 |
mcf |
According to this PR comment from 3 weeks ago php72-intl is supposed to be in there already: https://github.com/Homebrew/homebrew-php/pull/4211#issuecomment-307159234 |
# |
Jul 5th 2017, 19:56 |
cleptric |
No, it was ??= ? |
# |
Jul 5th 2017, 19:54 |
cleptric |
I’ll try it again later. ?== al the things |
# |
Jul 5th 2017, 19:51 |
savant |
probably some asshat out there if there are RCs has already PRd it |
# |
Jul 5th 2017, 19:49 |
cleptric |
To lazy to compile it by myself |
# |
Jul 5th 2017, 19:49 |
cleptric |
@mfc or better @savant Does hombrew added php72-intl That was my only show stopper a few days ago |
# |
Jul 5th 2017, 19:48 |
jeremyharris |
:P |
# |
Jul 5th 2017, 19:48 |
jeremyharris |
NOT IT |
# |
Jul 5th 2017, 19:48 |
admad |
wonderful phpunit issue again |
# |
Jul 5th 2017, 19:47 |
WyriHaximus |
There you go: https://travis-ci.org/cakephp/cakephp/jobs/250489011#L654-L656 |
# |
Jul 5th 2017, 19:32 |
WyriHaximus |
Was about to do the same :) |
# |
Jul 5th 2017, 19:29 |
admad |
I took the liberty of adding a commit on top :slightly_smiling_face: |
# |
Jul 5th 2017, 19:29 |
WyriHaximus |
Looking at it |
# |
Jul 5th 2017, 19:24 |
admad |
*travis config.. |
# |
Jul 5th 2017, 19:24 |
admad |
WyriHaximus: the nightly builds aren't running. The travis needs to be tweaked further https://travis-ci.org/cakephp/cakephp/jobs/250473818#L596 |