/** * Add a model to the list of models that should be included in all cases * * @param \Model $model The model to include * @throws \Exception When a model is of an unsupported type */ public function addInclude(\Model $model) { $type = strtolower($model->getType()); if (!in_array($type, $this->types)) { throw new \Exception("Objects of type \"{$model->getTypeForHumans()}\" are not supported"); } $this->included[$type][] = $model; }