protected function loadType($entity, $type, $new = true)
{
// Reference to an array with current entity's type instances
$types =& $this->entities[$entity];
// Return an entity object if it already exists and we don't need a new one.
if (isset($types[$type]) && $new === false) {
return $types[$type];
}
$class = $this->loadClass($entity, $type);
if ($class !== false) {
// Instantiate a new type object.
$types[$type] = new $class();
return $types[$type];
} else {
return false;
}
}