# |
May 27th 2016, 11:56 |
mesterjagel |
I get a â??Nicelyâ?? formatted string rather than numbers, anyone know why? |
# |
May 27th 2016, 11:56 |
mesterjagel |
$month = $query->func()->date_format([ 'created' => 'identifier', "'%Y:%M:%D'" => 'literal' ]); |
# |
May 27th 2016, 11:56 |
mesterjagel |
Hi guys:) Iâ??m using the date_format function from the ORM to group some entries like this: |
# |
May 27th 2016, 11:52 |
johnW_ |
now we are using something like this -> $user->created->nice('Europe/Paris') |
# |
May 27th 2016, 11:51 |
johnW_ |
is there option in cakephp3 that I can always read data in UTC+2 time and when I write data or edit that is always in UTC-0 saved in DB? Not manual for each date/time... something global... thx |
# |
May 27th 2016, 11:47 |
Neon1024x |
https://github.com/lorenzo/cakephp3-examples/blob/master/config/Schema/world.sql |
# |
May 27th 2016, 11:47 |
sab-cakefest |
Thanks Neon1024! |
# |
May 27th 2016, 11:45 |
Neon1024x |
sab-cakefest, Here is the link to the belongsToMany Through option, http://book.cakephp.org/3.0/en/orm/associations.html#using-the-through-option |
# |
May 27th 2016, 11:44 |
elboletaire |
After what we've discussed, I'm not gonna use View Cells. As you previously said it's a good replacement for the old `requestAction` method, so... moving the logic to the tables should be my main priority now x__D |
# |
May 27th 2016, 11:37 |
bernat1 |
Or do you want to write blocks in the view cell and read them in the main view? I think that would be awful to do with view cells. |
# |
May 27th 2016, 11:35 |
bernat1 |
@elboletaire, do you really need to pass the main view? Can't you just pass the blocks? I think it would make sense passing just what the cell needs. You'd have a more reusable view cell. |
# |
May 27th 2016, 11:32 |
unorthodox |
Gah, requestAction. |
# |
May 27th 2016, 11:31 |
bernat1 |
@elboletaire, view cells is a new feature in 3.0, we have lived long without them and I don't use them. It can replace the old requestAction method that some people needed, not me. They help reuse controller actions from views. |
# |
May 27th 2016, 11:30 |
elboletaire |
thanks @fquffio, it's a good example :slightly_smiling_face: |
# |
May 27th 2016, 11:30 |
spriz |
I feel like Iâ??m missing something, I sure canâ??t be the first that wants to edit a bunch of objects at once? :P |
# |
May 27th 2016, 11:29 |
spriz |
Am I doing something stupid when implementing a â??bulk editâ? Crud Action? |
# |
May 27th 2016, 11:27 |
fquffio |
@elboletaire: for instance, I wanted to show the amount of tickets assigned to the logged user on every page. This required a small amount of logic to be executed, but that had nothing to do with the current controller/action, and especially I didn't want that logic to be executed if I wasn't rendering the view (APIs), so I used view cells. :) |
# |
May 27th 2016, 11:21 |
elboletaire |
Then... what would be a good reason to use a view cell? Now I don't get how could I use them xD |
# |
May 27th 2016, 10:59 |
bernat1 |
I misunderstood, hehe. :) |
# |
May 27th 2016, 10:59 |
unorthodox |
Fat Models, Skinny Controllers |
# |
May 27th 2016, 10:59 |
bernat1 |
ah, ok, sorry. :-/ |
# |
May 27th 2016, 10:58 |
elboletaire |
exactly, thanks @unorthodox you got the point xD |
# |
May 27th 2016, 10:58 |
unorthodox |
Tell that to his/her coworkers :slightly_smiling_face: |
# |
May 27th 2016, 10:58 |
elboletaire |
That's what I do man, but not my work companions... |
# |
May 27th 2016, 10:58 |
bernat1 |
your logic should be called from the controller but implemented somewhere else to improve reusability. |
# |
May 27th 2016, 10:58 |
bernat1 |
@elboletaire, most people don't put everything in the controllers but on models and auxiliar objects. |
# |
May 27th 2016, 10:57 |
unorthodox |
You are welcome ! |
# |
May 27th 2016, 10:56 |
elboletaire |
thanks for the suggestions guys :slightly_smiling_face: |
# |
May 27th 2016, 10:56 |
elboletaire |
Well, something's obvious here, I need to refactor more this project because I'm the only person on this project who cares about distributing the logic between tables and entities, whilst the other people working here puts almost everything in the controllers (which is a pain for me, ovbiously) |
# |
May 27th 2016, 10:53 |
unorthodox |
Either that, or just the tiny parts of controllers that you might need to be changed. |
# |
May 27th 2016, 10:53 |
elboletaire |
But I would like to maintain my logic.. or are you saying to create the controllers with each theme? |
# |
May 27th 2016, 10:53 |
elboletaire |
I know............ |
# |
May 27th 2016, 10:52 |
unorthodox |
Well Cakephp 3 supports themes. |
# |
May 27th 2016, 10:52 |
elboletaire |
But doing that.. what do you do when you need to change the entire template? you'll need then probably to do changes to your controller, right? |
# |
May 27th 2016, 10:52 |
unorthodox |
I actually never used view cells/blocks either. I, also, push data from controller to elements. |
# |
May 27th 2016, 10:51 |
bernat1 |
It might be that you're using the wrong pattern for what you're trying, at least with CakePHP. I personally prefer elements and pushing data from the controller, but probably others with more knowledge know better patterns for your case. |
# |
May 27th 2016, 10:48 |
elboletaire |
But if I have no option, I guess I'll continue doing that... u___u |
# |
May 27th 2016, 10:46 |
elboletaire |
I would prefer*** |
# |
May 27th 2016, 10:46 |
elboletaire |
and I would rather preffer not passing `$this` to almost every cell :_D |
# |
May 27th 2016, 10:46 |
elboletaire |
well.. I would rather preffer using `$this->Html` instead of `$template->Html` |
# |
May 27th 2016, 10:45 |
bernat1 |
That said, passing arguments is not that bad, is it? |