Fuel Documentation

Orm

Orm is short for Object Relational Mapper which does 2 things: it maps your database table rows to objects and it allows you to esteblish relations between those objects.
It follows closely the Active Record Pattern, but was also influenced by other systems.

Observers: Introduction

An event based system to allow you to add behavior to specific events. When an event is observed the Orm will automaticly call all the added observers to see if there's anything for them to do.

Adding observers to your model

You can add observers in 2 ways: just add the name to have the observer called for all events or with the observer as name and an array of specific events for which the observer is called.
When the Observer is in the same namespace as the Model and prefixed with Observer_ you can leave out the "Observer_" prefix. In all other cases you have to provide the full classname.

class Model_Article {
	protected static $_observers = array(
		'example', // will call Observer_Example class for all events
		'Orm\\Observer_CreatedOn' => array('before_insert'), // will only call Orm\Observer_CreatedOn at before_insert event
	);
}