/** * @param TemplateModel $template * @return TemplateModel */ public function create(ModelAbstract $template, $org = null) { if ($template->getId()) { throw new InvalidArgumentException('Supplied template model already has an Id'); } if (!$template->getType()) { throw new InvalidArgumentException('Supplied template model needs a type'); } if (!$org) { $org = \App::getOrgUserLogged(); } $template->setOrganizationId($org->getId()); return parent::create($template); }