You are not logged in.
Pages: 1
Hi,
is there any example of handling one to many (has/belongs) and many to many relations?
thanks,
migajek
Offline
Not yet such example.
You'll have to do it manually, with relational tables:
type
TSQLOne = class(TSQLRecord);
TSQLTwo = class(TSQLRecord);
TSQLMany2Many = class(TSQLRecord)
published
One: TSQLOne;
Two: TSQLTwo;
end;
Then populate TSQLMany2Many with some IDs in One or Two properties (not pointers to objects, but IDs of TSQLOne or TSQLTwo).
Then query for all linked items with OneFieldValues() method.
The framework create indexes for such properties.
So the result will be very fast.
I'll try to implement direct one to many or many to many properties creations, directly in the main table. I don't like the collection-oriented way of tiOPF. I'll try to find another way of declaring those.
If you have any idea/preference, feel free to post here!
Offline
"Has many" is now integrated into the framework.
Offline
Pages: 1