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: Has Many

Specifies a one-to-many relationship to another model. The target model must include a "Belongs To" reference to the current model to allow the inverse relationship.

Full config example with defaults as values

// in a Model_Post which has many comments
$_has_many = array(
	'comments' => array(
		'key_from' => 'id',
		'model_to' => 'Model_Comment',
		'key_to' => 'post_id',
		'cascade_save' => true,
		'cascade_delete' => false,
	)
);