# |
May 7th 2021, 17:22 |
kevin.pfeifer |
see this comment and the one bellow it |
# |
May 7th 2021, 17:21 |
kevin.pfeifer |
1. no you don't need a seperate id column 2. if you stick with the cakephp naming conventions for table and column names it should auto-generate just fine with `cake bake all tablename` |
# |
May 7th 2021, 17:20 |
mehov |
Hi everyone! Quick question about a join table design for a HABTM association. Let's call it `articles_tags`. - Does it require a surrogate id? So `id | article_id | tag_id` - Or can I have only `article_id | tag_id` and simply make them a combined primary key? If I go for the latter, will Cake automatically recognise it, or will I have to configure something in the Table class? And am I going to regret this decision? |
# |
May 7th 2021, 16:46 |
thomas078 |
New Authentication seems to have token based auth as well |
# |
May 7th 2021, 16:45 |
thomas078 |
@greg138 Thanks. Just started to look new plugin and doing some tests to get an idea of everything i have to change. |
# |
May 7th 2021, 16:44 |
greg138 |
I believe that it's one or the other. The new plugins work just fine with 3.9, so you can do that conversion any time. |
# |
May 7th 2021, 16:16 |
thomas078 |
sure, this is an old project. Need to do plan for migrating 4 |
# |
May 7th 2021, 16:12 |
kevin.pfeifer |
sorry, but I haven’t used the Cake3 AuthComponent in quite some time so I don’t want to give you some wrong info ^^ Someone else has to answer that |
# |
May 7th 2021, 16:06 |
thomas078 |
@kevin.pfeifer Can i use Auth component and Authentication side by side. Have not yet migrated 3.9 to 4 |
# |
May 7th 2021, 16:04 |
kevin.pfeifer |
@thomas078 currently cakephp4 has 2 separate plugins for authentication and authorization See https://book.cakephp.org/4/en/tutorials-and-examples/cms/authentication.html and https://book.cakephp.org/4/en/tutorials-and-examples/cms/authorization.html The AuthComponent from Cake3 is deprecated (as stated in https://book.cakephp.org/3/en/controllers/components/authentication.html) |
# |
May 7th 2021, 16:02 |
ndm |
Just explicitly call `all()` beforehand |
# |
May 7th 2021, 16:01 |
neon1024 |
Don’t worry. Just a bit frustrated that I couldn’t chase a method to find out what the second param meant :) |
# |
May 7th 2021, 16:00 |
kevin.pfeifer |
sorry @neon1024 but what are you trying to fix aka what is the problem? ,:) |
# |
May 7th 2021, 15:57 |
thomas078 |
using Auth Component currently |
# |
May 7th 2021, 15:52 |
thomas078 |
I have Cake3.9 and need to do quasar.dev frontend to it. Thinking of Token based auth. Any strategies/ideas? |
# |
May 7th 2021, 15:51 |
neon1024 |
Should link to the right version :man-facepalming: https://github.com/cakephp/cakephp/blob/4.0.10/src/ORM/Query.php#L54 |
# |
May 7th 2021, 15:50 |
neon1024 |
Which from here is really hard, for me, to find out the method declaration |
# |
May 7th 2021, 15:50 |
neon1024 |
https://github.com/cakephp/cakephp/blob/master/src/ORM/Query.php#L54 |
# |
May 7th 2021, 15:50 |
neon1024 |
In Query.php. :) |
# |
May 7th 2021, 15:48 |
kevin.pfeifer |
and on what object you are using it on |
# |
May 7th 2021, 15:48 |
kevin.pfeifer |
depends on in which context you are |
# |
May 7th 2021, 15:48 |
kevin.pfeifer |
well there are many `function max(` present in vendor |
# |
May 7th 2021, 15:46 |
neon1024 |
I didn’t find the file it was declared in! I searched the docs for max |
# |
May 7th 2021, 15:46 |
neon1024 |
I think it’s because that Query class has all that weird import stuff for the query trait, then the query ResultSet includes Collections, etc |
# |
May 7th 2021, 15:46 |
kevin.pfeifer |
you mean from the CollectionInterface? |
# |
May 7th 2021, 15:45 |
neon1024 |
But clicking it in PHP Storm takes me to an `@method` declaration which is a dead end and still doesn’t describe the params, it’s a bit frustrating :( |
# |
May 7th 2021, 15:44 |
neon1024 |
Hah, no, it’s in Collections apparently |
# |
May 7th 2021, 15:44 |
kevin.pfeifer |
you mean this one? https://github.com/cakephp/cakephp/blob/master/src/Database/FunctionsBuilder.php#L76 |
# |
May 7th 2021, 15:41 |
neon1024 |
I’ll guess that `int type` can be `1` :shrug: |
# |
May 7th 2021, 15:41 |
neon1024 |
:facepunch: |
# |
May 7th 2021, 15:41 |
neon1024 |
> max() > Calculate the max of a column. Assumes arguments are literal values. |
# |
May 7th 2021, 15:41 |
neon1024 |
I mean the docs are just as helpful |
# |
May 7th 2021, 15:40 |
neon1024 |
Just a docblock with type int |
# |
May 7th 2021, 15:40 |
neon1024 |
Anyone know how to use `max()` doesn’t seem to exist in the actual code |
# |
May 7th 2021, 13:55 |
kailas |
anyway, works now |
# |
May 7th 2021, 13:55 |
kailas |
@neon1024 ugh, i could have sworn i did just this before and it didn’t work… |
# |
May 7th 2021, 13:46 |
kevin.pfeifer |
reasons is explained here https://github.com/cakephp/cakephp/pull/14912 |
# |
May 7th 2021, 13:45 |
kevin.pfeifer |
ah but here https://github.com/cakephp/cakephp/blob/master/src/ORM/Behavior.php#L189 |
# |
May 7th 2021, 13:45 |
kevin.pfeifer |
I don't see any deprecation warnings here :thinking_face: https://github.com/cakephp/cakephp/blob/master/src/ORM/Table.php#L386 |
# |
May 7th 2021, 13:43 |
greg138 |
Contrary to how most other classes have gone, the base class says that `getTable` is deprecated, and `table` is preferred. |
# |
May 7th 2021, 13:23 |
neon1024 |
I can see that the Timestamp behaviour uses `$this->table()` https://github.com/cakephp/cakephp/blob/master/src/ORM/Behavior/TimestampBehavior.php#L214 |