There is a ManyToOne association defined between Pattern and Category objects (the template is the party that owns the relationship). A category has many templates; a template belongs to one category. So, there is a Pattern.category field with @ManyToOne Doctrine annotation.
Now in my script I have the id of the Category object (sent from the form), which I want to assign to the Pattern.category field of the newly created template (which will be saved), but I do not want to load this Category object - I do not need it, I just want create a Pattern object, assign it a category (which I have) and save it. It seems strange to me that I need to load the Category object in order to establish a connection, when all I really need is just the identifier that I already have.
It may smell like using the concepts of relational databases with ORM, but it seems completely pointless to download this object only to establish a connection when I know the identifier of this target.
I am new to Doctrine btw.
source share