# |
May 1st 2019, 12:58 |
slackebot |
<neon1024> |
# |
May 1st 2019, 12:58 |
neon1024 |
So I can do `$this->Contents->find()->contain(['Parent']);` |
# |
May 1st 2019, 12:57 |
neon1024 |
For example, I have this in my `ContentsTable` |
# |
May 1st 2019, 12:57 |
slackebot |
<neon1024> |
# |
May 1st 2019, 12:57 |
neon1024 |
@noel You can create an association which just specifies all the options, and set them to the same table. The main thing to remember is that the Aliased name of the table will be how you refer to it. |
# |
May 1st 2019, 12:46 |
admad |
@rudy1976s @maymeow meanwhile you can peek in the future https://book.cakephp.org/3.next/en/index.html |
# |
May 1st 2019, 12:42 |
admad |
when either @markstory or @savant wakes up :slightly_smiling_face: |
# |
May 1st 2019, 12:38 |
maymeow |
cookbook is availabele on github but when it will be back online ? :slightly_smiling_face: |
# |
May 1st 2019, 12:19 |
noel |
Hi @neon1024 :slightly_smiling_face: are you able to guide me on creating a self-referencing many to many association (and required SQL)? |
# |
May 1st 2019, 11:38 |
rudy1976s |
good morning! the cookbok id apparently down |
# |
May 1st 2019, 10:46 |
neon1024 |
:thumbsup: |
# |
May 1st 2019, 10:46 |
megan |
@neon1024 yup! Have let the team know - Mark did an optimisation thing last night, so could be related. In the meantime you can use https://book.cakephp.org/3.next/en/index.html :slightly_smiling_face: |
# |
May 1st 2019, 10:42 |
fra.bdn |
Hi, the DebugKit stopped working, on the JS console I get a: 404 for http://localhost/debug-kit/toolbar/<a uuid> And the browser just shows a red square on the bottom right of the screen. |
# |
May 1st 2019, 10:37 |
COOurb |
So it kind adoesn't touch 'entity' and all it's stuff |
# |
May 1st 2019, 10:37 |
COOurb |
well, I'm using update() in query builder. Can it be reason why timestamp doesn't work? |
# |
May 1st 2019, 10:35 |
COOurb |
ye |
# |
May 1st 2019, 10:34 |
kiwi_73 |
is http://book.cakephp.org down? |
# |
May 1st 2019, 10:24 |
COOurb |
nope. doesn't work |
# |
May 1st 2019, 10:22 |
neon1024 |
Here is the documentation https://github.com/cakephp/docs/blob/3.0/en/orm/behaviors/timestamp.rst#using-and-configuring-the-behavior |
# |
May 1st 2019, 10:21 |
COOurb |
ok |
# |
May 1st 2019, 10:21 |
COOurb |
dunno |
# |
May 1st 2019, 10:20 |
neon1024 |
Probably easier to update your schema |
# |
May 1st 2019, 10:20 |
neon1024 |
..and using MySQL of course |
# |
May 1st 2019, 10:20 |
neon1024 |
That might be the root of your issue if you’re not escaping |
# |
May 1st 2019, 10:20 |
neon1024 |
Yes, it is. https://dev.mysql.com/doc/refman/5.7/en/keywords.html#keywords-5-7-detailed-D |
# |
May 1st 2019, 10:19 |
neon1024 |
Isn’t ‘date’ a reserved word? |
# |
May 1st 2019, 10:17 |
COOurb |
$this->addBehavior('Timestamp',['events'=>['Model.beforeSave'=>['date'=>'always']]]); |
# |
May 1st 2019, 10:16 |
neon1024 |
As you can see the behaviour foreach’s the config and updates those fields, https://github.com/cakephp/cakephp/blob/c15a2e9c1933fa5a874c33d2bcb6d63efacf8876/src/ORM/Behavior/TimestampBehavior.php#L101 |
# |
May 1st 2019, 10:15 |
neon1024 |
You can see here that the eventName is configured with specific fields, you overwrite these to use timestamp with your own fields |
# |
May 1st 2019, 10:15 |
neon1024 |
https://github.com/cakephp/cakephp/blob/c15a2e9c1933fa5a874c33d2bcb6d63efacf8876/src/ORM/Behavior/TimestampBehavior.php#L53-L56 |
# |
May 1st 2019, 10:13 |
COOurb |
?? sorry, didn't get it |
# |
May 1st 2019, 10:13 |
neon1024 |
Well, anyway, you’ll want to pass an array of config to the bejhaviour to add your field |
# |
May 1st 2019, 10:12 |
neon1024 |
https://downforeveryoneorjustme.com/book.cakephp.org |
# |
May 1st 2019, 10:12 |
COOurb |
I have it offline |
# |
May 1st 2019, 10:12 |
neon1024 |
@megan The cake book is 404 :( |
# |
May 1st 2019, 10:12 |
COOurb |
copy it from the book |
# |
May 1st 2019, 10:11 |
neon1024 |
@yannickfogang My first question would be why are you not using the ORM |
# |
May 1st 2019, 10:11 |
COOurb |
$this->addBehavior('Timestamp', ... |
# |
May 1st 2019, 10:11 |
COOurb |
yep. |
# |
May 1st 2019, 10:11 |
neon1024 |
COOurb, Did you configure the behaviour in your Table class to use the new field? |
# |
May 1st 2019, 10:04 |
COOurb |
type of date field it DATETIME |