# |
Jul 21st 2017, 15:10 |
neon1024 |
Thanks for all the help @jeremyharris I appreciate it :slightly_smiling_face: |
# |
Jul 21st 2017, 15:08 |
jeremyharris |
@neon1024 yes |
# |
Jul 21st 2017, 15:08 |
bernat |
I'll do a PR and see what comments I get. |
# |
Jul 21st 2017, 15:08 |
jeremyharris |
or, perhaps, remove the post data example (marshaling) from the one in the saving entities section, and remove the entity example from the other one |
# |
Jul 21st 2017, 15:08 |
bernat |
yes, I'll do now that I have some kind of confirmation. thanks! |
# |
Jul 21st 2017, 15:07 |
neon1024 |
So the first record is id 1? |
# |
Jul 21st 2017, 15:07 |
neon1024 |
So am I right in assuming this is auto increment? |
# |
Jul 21st 2017, 15:07 |
neon1024 |
https://github.com/cakephp/cakephp/blob/master/tests/Fixture/ArticlesFixture.php#L45 |
# |
Jul 21st 2017, 15:07 |
jeremyharris |
yeah it looks pretty duplicated. perhaps you can edit the doc? |
# |
Jul 21st 2017, 15:06 |
bernat |
probably the section in my link should be removed because it seems to be already documented in your link |
# |
Jul 21st 2017, 15:06 |
bernat |
doesn't it seem like there's something duplicated and outdated there? |
# |
Jul 21st 2017, 15:05 |
jeremyharris |
yes, I think that might be wrong |
# |
Jul 21st 2017, 15:05 |
jeremyharris |
sorry I got confused by all the examples, didn’t know which one you were looking at |
# |
Jul 21st 2017, 15:05 |
jeremyharris |
I see |
# |
Jul 21st 2017, 15:05 |
bernat |
that's the example I was referring to, sorry |
# |
Jul 21st 2017, 15:05 |
bernat |
jeremyharris, please see the second code block in my link |
# |
Jul 21st 2017, 15:04 |
bernat |
I'm not sure. To me the Tags example is wrong because it doesn assign the result of the newEntity call. There's no save in it, it's like the other example. |
# |
Jul 21st 2017, 15:04 |
jeremyharris |
in the tags example, since the data is added to the entity manually (not via newEntity or patchEntity), you don’t need to tell the marshaler to include it when it’s building the entities |
# |
Jul 21st 2017, 15:03 |
jeremyharris |
the tags one is what associated entities to *save*, while the courses example shows what data should be *patched*, that is, added to entities |
# |
Jul 21st 2017, 15:00 |
bernat |
in the second example the associated models are just Tags, but in the first one it has to use Courses._joinData |
# |
Jul 21st 2017, 14:59 |
bernat |
see the newEntity line |
# |
Jul 21st 2017, 14:59 |
jeremyharris |
why what is different? |
# |
Jul 21st 2017, 14:58 |
bernat |
jeremyharris, it's true, you've found it, but can someone tell me why is it different here? https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-data-to-the-join-table |
# |
Jul 21st 2017, 14:54 |
jeremyharris |
bernat see: https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-additional-data-to-the-join-table |
# |
Jul 21st 2017, 14:54 |
jay |
mirec Testing is easier than it looks |
# |
Jul 21st 2017, 14:54 |
jeremyharris |
bernat _joinData is a special parameter that add items to the join table entity |
# |
Jul 21st 2017, 14:53 |
jeremyharris |
subject isn’t even passed to the listener arguments |
# |
Jul 21st 2017, 14:53 |
jeremyharris |
birdy247 so I had to look it up because I don’t use magic arguments, but everything after the first argument passed to the listener should be the data |
# |
Jul 21st 2017, 14:53 |
mirec |
ok so I will try to write tests too. I think naming tables when baking migration snapshots would be nice feature, so I will code it |
# |
Jul 21st 2017, 14:52 |
bernat |
It's weird using _joinData as a model name, also it's not documented and I don't remember having it used like this |
# |
Jul 21st 2017, 14:51 |
jeremyharris |
it’s definitely worth learning |
# |
Jul 21st 2017, 14:51 |
bernat |
Hi. Is this answer the correct one? https://stackoverflow.com/questions/32969433/cakephp-3-save-extra-data-in-join-table |
# |
Jul 21st 2017, 14:51 |
neon1024 |
Great time to learn! |
# |
Jul 21st 2017, 14:51 |
jeremyharris |
we can help with that mirec :slightly_smiling_face: |
# |
Jul 21st 2017, 14:50 |
mirec |
guys, can I make some new feature to cakephp (migrations plugin) without writing tests? is there somebody who could write tests after I make pull request? cause I do not know how to do it properly :)) |
# |
Jul 21st 2017, 14:50 |
jeremyharris |
ok so you are using the magic arguments, not $event->getData |
# |
Jul 21st 2017, 14:50 |
birdy247 |
i.e. $start |
# |
Jul 21st 2017, 14:50 |
birdy247 |
instead its the optional data I send it |
# |
Jul 21st 2017, 14:49 |
birdy247 |
i.e. an instance of the subject with access to its properties |
# |
Jul 21st 2017, 14:49 |
birdy247 |
in the listener, the 2nd param is not what I expect |
# |
Jul 21st 2017, 14:49 |
jeremyharris |
I’m confused - what’s the problem birdy? |