I found a work-around on database level. Doctrine only needs to know the 
fist half of the foreign key. (The "id"-part.) The missing piece is 
injected via a database trigger:
CREATE OR REPLACE FUNCTION on_insert_or_update_rental_unit_allocation()
RETURNS trigger AS '
BEGIN
  NEW.rental_unit_lifetime := ( SELECT lifetime FROM rental_unit WHERE id = 
NEW.rental_unit_id );
  RETURN NEW;
END' LANGUAGE 'plpgsql';

CREATE TRIGGER rental_unit_allocation_insert_trigger BEFORE INSERT ON 
rental_unit_allocation FOR EACH ROW EXECUTE PROCEDURE 
on_insert_or_update_rental_unit_allocation();

CREATE TRIGGER rental_unit_allocation_update_trigger BEFORE UPDATE ON 
rental_unit_allocation FOR EACH ROW EXECUTE PROCEDURE 
on_insert_or_update_rental_unit_allocation();


-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to