[TYPO3-dev] IRRE - processDatamap_afterDatabaseOperations
Brian Bendtsen
bb at bellevuevej.dk
Thu Jun 26 10:33:23 CEST 2008
Hi
This one is hard to explain, but here goes...
I need to update a table when I create another, therefore I use the
processDatamap_afterDatabaseOperations hook.
Lets say Im making a hotel application and have 3 tables:
Room(uid, size, facilities, section ...)
Bed(uid, room, size ...) - room is foreign key
Stats(uid, section, numberOfBeds ...)
I have an IRRE between Room and Bed, so its possible to create/delete
beds from editing a room.
When I add a bed to a room I want to update the stats table, which holds
the number of beds in different sections of a hotel.
If I create a bed item the traditional way, where I choose a
room(foreign key), size and so on everthing runs as it should, but if I
create the bed from within the room, thereby setting the room
automatically it fails.
The first thing I do in my function is fetching the room like this:
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('Bed.room, Bed.size',
'Bed','Bed.uid ='.$id);
Apparently, when using IRRE the Bed.room returns a 0 but Bed.size
returns the correct value.
When not using IRRE to create a Bed, Bed.room is returning the correct
value.
I cant quite grasp what the problem is.
Any hints?
/Brian
More information about the TYPO3-dev
mailing list