[Flow] Access to related object in One-to-many relation

Matteo C. mathaios76 at gmail.com
Wed Sep 11 00:13:31 CEST 2013


Dear Flow gurus,

I've just started to explore this fantastic framework but I'm already
struggling with it, in particular this is my case, written as most
succinctly as possible:

- Contact class with a one-to-many relation (bidirectional) to an Address
class
- Initially I did setup the relation as an aggregate, whit the Contact
class as the aggregate root. Like this I was able to add and delete
Addresses using the Address controller and the Contact repository.
- reading around I discovered that being an aggregate, it was not possible
to access an Address directly in order to be edited, but the whole
collection needed to be handled, I'm I correct ?
- so I created an Address Repository and injected in to the Address
controller, but once I pass from the view the identifier of the Address
object I wish to edit, I'm getting again the whole object structure, that
is the Contact object and the full Addresses collection.
What is the correct procedure to retrieve only an Address object and edit
it ?

For the good souls that want to throw a look into it, I did create a gist
(bad coding ahead, it's just a test...)

https://gist.github.com/Teox76/6516255

Thank you for any tips !!


More information about the Flow mailing list