Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Allowing change embbeded entities #166

Open
fabioginzel opened this issue Mar 24, 2015 · 15 comments
Open

Allowing change embbeded entities #166

fabioginzel opened this issue Mar 24, 2015 · 15 comments
Labels

Comments

@fabioginzel
Copy link

He should not allow change embbeded entities, like this:
{"id":"3",
"descricao":"name",
"tppdvi":{"id":"1", "descricao":"update name"}
}

@TomHAnderson
Copy link
Contributor

I don't understand what you're reporting. Are you talking about embedded data in ODM? Is this PUT or PATCH? What does tppdvi represent?

@fabioginzel
Copy link
Author

Tppdvi is a embedded doctrine entity and apigility allows to change the descricao field.

@TomHAnderson
Copy link
Contributor

That's interesting. Are you using ODM or ORM? Is there more about this you can add?

@fabioginzel
Copy link
Author

I called a translator.

I'm using apigility with doctrine. When I send a patch to the main entity I'm trying to update, it's also updating an embedded entity.

For example, let's say we have a students table and a courses table.
The student entity has it's course embedded.

When I patch the student entity, if somehow the course entity name is changed, it updates the course name on the courses table.

@TomHAnderson
Copy link
Contributor

Database = MySQL? MongoDB?

@fabioginzel
Copy link
Author

I've tested on MS Sql Server and PostgreSql.

@TomHAnderson
Copy link
Contributor

@veewee what do you think of this? Are your hydrators too good?

@takethefake
Copy link
Contributor

any news on this? I like the Idea of Posting directly to the subentities but i think there is a need to call the input validators of the nested entity, otherwise you'll run into errors.

@TomHAnderson
Copy link
Contributor

@veewee bumping this. I'd sure appreciate your insight on this.

@veewee
Copy link
Contributor

veewee commented May 8, 2015

Hi @TomHAnderson
Sadly, I haven't found the time to follow this repo up to the latest version.
It's exactly the same as with forms: if you submit the field:
tppdvi[descricao]=test, the field will be updated in the database.
I am perfectly fine with this feature and am using this on some projects.

If you don't want this feature, you can filter / validate the input yourself on pre-update ?

@fabioginzel
Copy link
Author

But if my user dont have permission to change embbeded entity?

@jguittard
Copy link
Contributor

@fabioginzel @veewee ping

@fabioginzel
Copy link
Author

hi

@michalbundyra
Copy link
Member

@fabioginzel do you still need any help with it or you have found the solution?

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas-api-tools/api-tools-doctrine; a new issue has been opened at laminas-api-tools/api-tools-doctrine#9.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants