# |
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? |
# |
May 27th 2016, 10:45 |
bernat1 |
The way I see it view cells were created to be independent reusable entities. You think coupling them to the main view would be good but I think de-coupling is a feature here. |
# |
May 27th 2016, 10:43 |
elboletaire |
I think that the proper way would be using view cells in my case, but, returning to the main question, why are view cells loading a new view instance? Why the hell do I need to pass `$this` to create view blocks? |
# |
May 27th 2016, 10:41 |
elboletaire |
Ok, let me explain that better... is more comfortable when you have a huge page which continuously changes its template. The more versatile way I've currently found to do it is dinamically loading content in elements, so I can create templates every time the client asks me for a new fraking design |
# |
May 27th 2016, 10:41 |
bernat1 |
Of course you can do things the way you want, but cakephp was created in a different mindset I guess. |
# |
May 27th 2016, 10:40 |
bernat1 |
I think the moment you said you're comfortable loading models in the view everyone fell off their chair. :) |
# |
May 27th 2016, 10:36 |
elboletaire |
Or, the same question but asked different... why are view cells NOT reusing the main View instance? |
# |
May 27th 2016, 10:34 |
elboletaire |
Then... the question would be.. what's the sense of using View Cells? It's much versatile using an element and load inside the `TableRegistry` (which breaks the MVC pattern, I know... but it's much more comfortable) |
# |
May 27th 2016, 10:33 |
elboletaire |
> A new View instance is used to render each cell and these new objects do not share context with the main template / layout. Each cell is self-contained and only has access to variables passed as arguments to the View::cell() call. |
# |
May 27th 2016, 10:33 |
elboletaire |
Ok, I've found it... |
# |
May 27th 2016, 10:32 |
elboletaire |
The only way I've found is passing `$this` to the view cell as another variable (`$template` in my case). But I don't get why view blocks do not work by default... :S |
# |
May 27th 2016, 10:31 |
elboletaire |
Why view blocks do not work inside view cells? |
# |
May 27th 2016, 10:18 |
veganista |
Anyway of automatically getting flash message serialised when requesting json? |
# |
May 27th 2016, 10:09 |
ionas |
shouldnâ??t it filter everything? |
# |
May 27th 2016, 10:07 |
spriz |
Hmm, is it correctly understood that thereâ??s no default support for bulk edit with just PUTâ??ing an array rather than one json object with CRUD? |
# |
May 27th 2016, 10:02 |
Neon1024x |
Worth reading the Phinx docs too imho |
# |
May 27th 2016, 09:59 |
bernat1 |
oh, I was looking at the bake pages. |
# |
May 27th 2016, 09:59 |
TheMiller |
I think working with migration-diffs is the most easiest way |
# |
May 27th 2016, 09:58 |
TheMiller |
http://book.cakephp.org/3.0/en/migrations.html#generating-a-diff-between-two-database-states |
# |
May 27th 2016, 09:58 |
TheMiller |
The in the cookbook |
# |
May 27th 2016, 09:58 |
bernat1 |
is there any docs to baking migrations, I didn't even knew that existed. |
# |
May 27th 2016, 09:58 |
TheMiller |
Thanks@all! |
# |
May 27th 2016, 09:57 |
Neon1024x |
D |
# |
May 27th 2016, 09:57 |
TheMiller |
That was the Problem. Wow, everything has been created. |
# |
May 27th 2016, 09:57 |
TheMiller |
bin/cake bake migration My-Migration |
# |
May 27th 2016, 09:57 |
TheMiller |
ah stop. sry, my fault |
# |
May 27th 2016, 09:57 |
Neon1024x |
bin/cake bake migration MyMigration |
# |
May 27th 2016, 09:57 |
Neon1024x |
So you're running something like |
# |
May 27th 2016, 09:57 |
TheMiller |
Which classname? |