It’s not clear what you’re trying to accomplish here. Can you give a little more context about what record you’re editing (guessing it’s “article”?) and what the relevant associations are?
joinData and then a hasmany relation, but that is uploadbehavior jose gonzalez, I posted it on github there, maybe its a problem related to the behaviour?
Normally you can save _joinData and then related records on that in one go?
My experience is saving related records which have _joinData, not the other way around. Always aim to make the names of the input controls match the xpath way of getting to that field in an entity you’ve read with normal containment.
When I add the uploadbehaviour to database ArticlesAttributeAttachments the upload behaviour does not upload the file as expected. The data is provided correctly just the behaviour is not triggered somehow.
I can save it directly and upload it, but when I save it as part of the _joinData.article_attribute_attachments nothing happens. I should test with some basic data if you can add it onto the _joinData see if that also not work.
So the question is, are you able to add extra relational data to _joinData?
This is what I am trying but it seems to not work. And I wonder if it is at all possible. But I have only tried with Images having the upload behaviour attached to it. So I can test with a regular table. But that’s why I am asking it, to see if anybody knows if it is possible to do that?
Not having seen your code, I will venture a guess.
You say
I find it very easy to look at debugs of patch data and not recognize that a deep level is still in array form when it should have been converted to an entity.
You may not be setting the associated key of your patchEntity() and save() calls properly to get your deeply nested data included.
Am I the only one that’s still confused by the presence of a further association on the _joinData? Is that a normal thing that I’ve just not come across before? In the structure under discussion, I’d expect that _joinData is an entity for the belongsToMany join table between Students and Courses. That join table itself then has a hasMany relationship to Images?
It’s not a structure or approach that I’ve used but it is an example straight from the book for use when the join table carries data beyond the two foreign-keys.
In that example the image could be a certificate that gets awarded on completion of the course…
I am using it for something else like attributes that you can attach to an article, and one kind of attribute is a file, so I want to attach the file to that record…
I know that it works with at least on a hasone association.
In one project I have the tables:
dishes (id, name, created, modified)
dishsizes (id, name,…)
currencies (id, name…)
and the join Table:
dishes_dishsizes (id, dish_id, dishsize_id, unitprice(dec 15,2), currency_id)
The join Table hasone currencies and on adding or editing a dish I can choose the currency for each dishsize.
I never tested it with fileupload and don’t know the uploadplugin you are using.
I tried it again with save ‘associated’ => … and it does not work like that. I can see the entity object is set correctly it just not gets saved to the database.