# |
Jul 18th 2017, 19:19 |
nicolas.r |
Hi |
# |
Jul 18th 2017, 19:19 |
privera085 |
hola |
# |
Jul 18th 2017, 18:29 |
mikesmoniker |
I would love to be able to do $user->groups->filter(…) etc. |
# |
Jul 18th 2017, 18:22 |
phantomwatson |
If you don't break a bunch of stuff, why bother? |
# |
Jul 18th 2017, 18:21 |
phantomwatson |
Well, backwards-compatibility breaks are what major version changes are for. :slightly_smiling_face: |
# |
Jul 18th 2017, 18:14 |
mikesmoniker |
Anyone know if there’s been any discussion about making associations collections instead of arrays in Cake 4? (BC break, I know…) |
# |
Jul 18th 2017, 18:07 |
nicolas.r |
i'll take a llok at |
# |
Jul 18th 2017, 18:06 |
phantomwatson |
Might want to use `$query->func()->max('states_id')`. https://book.cakephp.org/3.0/en/orm/query-builder.html#using-sql-functions |
# |
Jul 18th 2017, 18:05 |
nicolas.r |
Something is missing or badly build .. |
# |
Jul 18th 2017, 18:04 |
nicolas.r |
my subquery .. $subQuery = $query->buildStatement( array( 'fields' => array('original_demande', 'Max(States_id)'), 'table' => $db->fullTableName($this->Demandes), )); |
# |
Jul 18th 2017, 18:04 |
nicolas.r |
the subquery stuck me .. |
# |
Jul 18th 2017, 18:04 |
nicolas.r |
I try this ... $query = $this->Demandes->find() ->select(['*']) ->join([ 'table' => 'Demandes', 'alias' => 'd', 'type' => 'INNER', 'conditions' => 'Demandes.original_demande = ' . $subQuery]); But I dont know how to continue this ... |
# |
Jul 18th 2017, 18:03 |
nicolas.r |
3.4 |
# |
Jul 18th 2017, 18:03 |
phantomwatson |
CakePHP 2 or 3? |
# |
Jul 18th 2017, 18:02 |
nicolas.r |
Hi guys, I'm stuck for 2 days ago now ... I try to convert a sql query to the cake php format .. Can you help me ? this is the damn query : "SELECT d.* FROM demandes d INNER JOIN ( SELECT original_demande, MAX(states_id) AS states_id FROM demandes GROUP BY original_demande ) grouped ON d.original_demande = grouped.original_demande AND d.states_id = grouped.states_id" |
# |
Jul 18th 2017, 17:06 |
chris-andre |
Regarding middleware, I have something to learn (as well) |
# |
Jul 18th 2017, 17:05 |
admad |
Even better way than serving the images through controller is through middleware instead |
# |
Jul 18th 2017, 16:56 |
chris-andre |
Yes, right. Fair point. I'll go change my piece of code right away :P |
# |
Jul 18th 2017, 16:54 |
hmic |
another thing i forgot to mention: the page will only start rendering *anything* after the whole html got loaded - if that contains 1MB of image data (only) - you guess what happens - white page for *seconds* |
# |
Jul 18th 2017, 16:52 |
hmic |
without any additional setup this requires your apps auth to allow the url from the controller... very convenient IMHO |
# |
Jul 18th 2017, 16:52 |
chris-andre |
Yes @saeideng . At most 10 images. |
# |
Jul 18th 2017, 16:51 |
chris-andre |
Right, good points @hmic . Thanks. I think of the option/example you told. |
# |
Jul 18th 2017, 16:50 |
saeideng |
your images output is like `img ... ><img ... >.............. <img..` ??:grinning: |
# |
Jul 18th 2017, 16:50 |
hmic |
this makes (only) sense to embed *small* images to not have the overhead of doing another request to the webserver - this means: 1k or less for me. like icons. usually you would not even bother to encode them dynamically but put them base64 encoded in the markup, which is especially beneficial on mobile |
# |
Jul 18th 2017, 16:48 |
hmic |
you would rather create an controller action like: function getImage($photo) { ob_end_flush(); readfile($this->Image->imageUrl($photo)); } and link to that in the img src |
# |
Jul 18th 2017, 16:48 |
chris-andre |
Why I'm asking, didn't really think of that. |
# |
Jul 18th 2017, 16:47 |
saeideng |
yes and no |
# |
Jul 18th 2017, 16:47 |
chris-andre |
:oncoming_police_car: Allright. So it is clearly a bad idea |
# |
Jul 18th 2017, 16:46 |
hmic |
and the browsers, especially mobile ones, will have a hard time decoding the 100MBs of base64 encoded data |
# |
Jul 18th 2017, 16:45 |
hmic |
you add 1/3rd of additional traffic overhead on the webserver too for encoding them base64 |
# |
Jul 18th 2017, 16:45 |
hmic |
you would need your php to buffer all that crap, using up *lots* of memory |
# |
Jul 18th 2017, 16:44 |
hmic |
and displaying many of them? |
# |
Jul 18th 2017, 16:44 |
hmic |
have you thought of images bigger than some kb? |
# |
Jul 18th 2017, 16:44 |
chris-andre |
Yes. Why? That bad idea/practice? |
# |
Jul 18th 2017, 16:42 |
hmic |
chris-andre: really? |
# |
Jul 18th 2017, 16:42 |
chris-andre |
Are there other preferred ways of doing this, or I'm a fool thinking this at all? :P |
# |
Jul 18th 2017, 16:41 |
chris-andre |
Hi. I don't like the idea of having uploaded pictures etc available in a public folder or as a symbolic link, as one simply can share the direct link. What do you think of this way of rendering/showing pictures? https://gist.github.com/chris-andre/36d41ec5b7ac4b8ad0c7e2447096f814 |
# |
Jul 18th 2017, 16:33 |
savant |
ok :slightly_smiling_face: |
# |
Jul 18th 2017, 16:33 |
glafarge |
Sorry, my mistake :slightly_smiling_face: |
# |
Jul 18th 2017, 16:32 |
savant |
You can invite someone to the CakePHP slack via the invite app: http://cakesf.herokuapp.com/ |
# |
Jul 18th 2017, 16:32 |
savant |
@glafarge why did you unpin that? |