<?php

	class ChangeLogEventHandler extends kDBEventHandler {

		/**
		 * Updates affected record count in session, when change log record is deleted
		 *
		 * @param kEvent $event
		 */
		function OnAfterItemDelete(&$event)
		{
			parent::OnAfterItemDelete($event);

			$object =& $event->getObject();
			/* @var $object kDBItem */

			$sql = 'UPDATE ' . $this->Application->getUnitOption('session-log', 'TableName') . '
					SET AffectedItems = AffectedItems - 1
					WHERE SessionLogId = ' . $object->GetDBField('SessionLogId');
			$this->Conn->Query($sql);
		}
	}