database - How to update further tables on adding a relationship in propel -


i'm trying work out best place update other related tables when changing foreign-key dependency.

to precise, have table called 'flat' , called 'room' contains

flat_id: {type: integer, foreigntable:flat, foreignreference: id, required: true }

as method room::setflatid(), propel (1.3) has therefore given me room::setflat()

but when add room flat, want automatically make changes other related tables, keep consistency @ higher level database definition. thought override flat::addroom(room $room) call parent , make these further changes.

but i've run problem because, since 'flat_id' column required, 1 of setflatid() , setflat() called before room object saved.

but before room object saved, has no id, , therefore extended addroom cannot work because there no room_id identify related records in other tables.

this seems suggest mustn't put code flat::addroom() depends on room having been saved. can put code?

obviously, require called manually after making or changing room object; since doing maintaining kind of higher-level database integrity, i'm unwilling that. put 1 or both of 'save' methods; logically needs run when association between room , flat changed.

where should code go?

it's typical case custom behavior.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -