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.

Relations: Belongs To

Has the primary key of the relation keps in its table, belongs to 1 related object.

Full config example with defaults as values

// in a Model_Comment which belong to a post
$_belongs_to = array(
	'post' => array(
		'key_from' => 'comment_id',
		'model_to' => 'Model_Post',
		'key_to' => 'id',
		'cascade_save' => true,
		'cascade_delete' => false,
	)
);