jaguar_orm icon indicating copy to clipboard operation
jaguar_orm copied to clipboard

Manage association with object and not foreign key

Open jaumard opened this issue 5 years ago • 5 comments

I always find it weird that for one-to-many we set List<Object> in one side and only int id on the other side,

As v4 is going on I propose to change to always manage association with object instead of foreign key.

The will also us to use preload to load directly the nested object.

Most ORM manage relations with objects, I think it will be better to do it.

What do you think ?

jaumard avatar Jul 02 '19 11:07 jaumard

Can you give an example?

On parent side it is object. On child side, it is foreign key.

If you mean jaguar should create the foreign keys for the user instead?

tejainece avatar Jul 02 '19 14:07 tejainece

That's exactly that, in some case you might want to define your own foreign key but in most cases you're interested in getting the related parent. That can be a nice addition :)

jaumard avatar Jul 02 '19 19:07 jaumard

That would be perfect addition.

JankoLancer avatar Jul 16 '19 13:07 JankoLancer

@jaumard any idea when this will be available?

HTMHell avatar Aug 28 '19 14:08 HTMHell

No idea, I don't think someone is working on this so I'll say not any time soon. But PR are welcome if you're motivated to do it

jaumard avatar Aug 28 '19 15:08 jaumard