I am a week into CakePHP and have a built a simple application that is
doing some neat things.  But now I am stuck.  I'd like to have it log to
the database every time my primary model is viewed (or edited).  So I
have a logs table and it looks like this:

mysql> describe logs;
+----------+---------------------+------+-----+-------------------+----------------+
| Field    | Type                | Null | Key | Default           |Extra

+----------+---------------------+------+-----+-------------------+----------------+
| id       | bigint(20) unsigned | NO   | PRI |          |auto_increment
| main_id  | bigint(20)          | NO   |     |                   |

| time     | timestamp           | YES  |     | CURRENT_TIMESTAMP |

| referrer | varchar(1024)       | NO   |     |                   |

+----------+---------------------+------+-----+-------------------+----------------+
4 rows in set (0.00 sec)

Then I have a simple model for Log that belongs to Main.  Inside
MainsController, I have a method called view() that displays the Main
entry.  What is the "correct" way to also have view() create and write
the log?

Thank you, James

-- 
James P. Howard, II, MPA
[email protected]

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to