yep.
you've got it pretty much summed up right here
Quote:
class Garage
Set cars;
class Car
Garage garage;
bi-directional relationship. just create a car, give it a garage, then save it. Then, either the DB, or your code, should assign it the next number car and voila :)
for car you'll want a auto-incrementing field to create the id: car1, car2, car3, etc to keep that unique.
your garage table will have an id, fk car id (which is car1, car2, etc) and an index column which assigns each car a unique number for that garage when saved