I've set up (maybe the wrong approach) a HABTM relationship to handle status updates on a model record. For example:
Models: Activity, Statustype, ActivityStatus In my Activity model, I created a belongsTo relationship with Statustype and the table contains a statustype_id (relationship is called CurrentStatustype). This represents the current status of the Activity. I also created a HABTM relationship (unique = false) with the ActivityStatus/Statustype model (named Statustype). The theory being, anytime an Activity is updated it gets the current status change in the Activity and then writes a 'history' to the ActivityStatus table. So far the automagic happens just the way I want with one exception. The HABTM relationship does not auto populate the created and modified date fields in the ActivityStatus table. I know for most HABTM relationships this wouldn't be an issue as you could simply get those dates from the Activity table. But as I'm trying to create a running history of status changes, the date fields become critical. Is there a way to force these dates? Do I need to write a insertQuery in the relationship? Or do you think this is just a bad approach to the requirement? Thanks in advance. Russ -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
