# |
Sep 12th 2019, 13:03 |
admad |
by "db table" i meant your actual database table where you can set column defaults |
# |
Sep 12th 2019, 13:02 |
kailas |
where in the table? is there some callback on new entity? |
# |
Sep 12th 2019, 12:57 |
alice |
https://www.meetup.com/Brisbane-CakePHP-Meetup-Group/ |
# |
Sep 12th 2019, 12:57 |
alice |
For friends in Brisbane, would love to see you join our meet up group : ) |
# |
Sep 12th 2019, 12:56 |
alice |
Hello from Australia :flag-au: |
# |
Sep 12th 2019, 12:23 |
felix.robaglia |
1st option is enough for me, thanks again :slightly_smiling_face: |
# |
Sep 12th 2019, 12:03 |
conehead |
I personally prefer the first option as you can cleary see how many levels deep you go. With the third option you can add more limitations |
# |
Sep 12th 2019, 12:00 |
felix.robaglia |
I prefer the first one you mentioned, maybe the 2nd one is better for readability though ? :slightly_smiling_face: |
# |
Sep 12th 2019, 11:58 |
conehead |
There are 2 other ways as well. `'Contracts.Users', 'Contracts.Sources'` Or `'contain' => ['Contracts' => function (Query $q) { return $q->contain(['Users]); } |
# |
Sep 12th 2019, 11:56 |
felix.robaglia |
works perfectly, thanks @conehead. |
# |
Sep 12th 2019, 11:53 |
conehead |
``` $this->paginate = [ 'contain' => ['Contracts' => ['Users', 'Sources']] ]; ``` |
# |
Sep 12th 2019, 11:52 |
felix.robaglia |
i want to do something like this : ``` $this->paginate = [ 'contain' => ['Contracts' => contain('Users, 'Sources')] ]; ``` |
# |
Sep 12th 2019, 11:51 |
felix.robaglia |
But each of my contracts contain a User and a Source, how do I "nest" contains ? |
# |
Sep 12th 2019, 11:50 |
felix.robaglia |
Hello, I have the following assocation in my index method: ```$this->paginate = [ 'contain' => ['Contracts'] ];``` |
# |
Sep 12th 2019, 11:49 |
valerij.bancer |
Hi, how to execute `SELECT DISTINCT ...` in 3.x without using `GROUP BY` that is generated by `distinct()` method? |
# |
Sep 12th 2019, 11:22 |
fhxfhx |
k tx |
# |
Sep 12th 2019, 11:21 |
conehead |
But this doesn't have to mean that the config is not overridden somewhere else (although it shouldn't). And it depends on the plugin if it has a db config |
# |
Sep 12th 2019, 11:17 |
spriz |
before jumping into real life code |
# |
Sep 12th 2019, 11:17 |
spriz |
I would go through this tutorial if I were you: https://book.cakephp.org/3.0/en/tutorials-and-examples/cms/installation.html |
# |
Sep 12th 2019, 11:16 |
spriz |
https://book.cakephp.org/3.0/en/orm/database-basics.html is what you are looking for |
# |
Sep 12th 2019, 11:16 |
spriz |
at least imo that is the most common usecase, however you can connect multiple if you want to |
# |
Sep 12th 2019, 11:16 |
spriz |
fhxfhx: Usually you would have just one datasource defined in `app.php` |
# |
Sep 12th 2019, 11:08 |
fhxfhx |
... also, do plugins have their own db config ? |
# |
Sep 12th 2019, 11:08 |
fhxfhx |
in cake3.5, where do i see which is my connected db ? |
# |
Sep 12th 2019, 09:55 |
jotpe |
ok, thank you :slightly_smiling_face: |
# |
Sep 12th 2019, 09:55 |
spriz |
I use way more components that cells generally fwiw ÆD |
# |
Sep 12th 2019, 09:55 |
admad |
fhxfhx: if you don't see composer.json is a cake 2 app (or cake 1), in that case check for lib/Cake/VERSION.txt |
# |
Sep 12th 2019, 09:55 |
spriz |
if you also have a view file with some if or whatever, then I'd put it in a cell |
# |
Sep 12th 2019, 09:54 |
spriz |
I tend to put stuff in components if it is controller-logic only |
# |
Sep 12th 2019, 09:54 |
fhxfhx |
k tx |
# |
Sep 12th 2019, 09:54 |
spriz |
fhxfhx composer.json or composer.lock would be a great place to start if it is with composer ÆD |
# |
Sep 12th 2019, 09:54 |
jotpe |
So component or cell? |
# |
Sep 12th 2019, 09:53 |
jotpe |
And I have a backend/frontend which use the same AppController, but the navigation is only for the fe |
# |
Sep 12th 2019, 09:53 |
fhxfhx |
hi, I'm picking up on a project I had started with someone who's not available any more. I wanted to find out which cake version was used on the app, and under which path the cakePhp-framework files are located |
# |
Sep 12th 2019, 09:53 |
admad |
then write a component :slightly_smiling_face: |
# |
Sep 12th 2019, 09:52 |
jotpe |
I want to keep my AppController as clean as possible |
# |
Sep 12th 2019, 09:52 |
spriz |
if it has controller-ish logic, a view cell sounds like a good place though Æ= |
# |
Sep 12th 2019, 09:51 |
spriz |
and use the variable in an element/layout |
# |
Sep 12th 2019, 09:51 |
spriz |
Or you can set this in the AppController in beforeFilter or beforeRender |
# |
Sep 12th 2019, 09:50 |
jotpe |
? |
# |
Sep 12th 2019, 09:50 |
jotpe |
I have a navigation in my layout which is based on data set by a controller. I want to use this navigation on every page in my frontend, but I don't want to set the variable in every controller. Is a view cell a good place to implement this |