function action_new() { PermissionHelper::Verification('Editor'); $name = $_POST['inputName']; $sectionName = $_POST['inputSection']; $attribute = $_POST['attributes']; $catalogue = new Catalogue(); $catalogue->name = $name; $catalogue->section_id = SectionService::GetByName($sectionName)->section_id; CatalogueService::Create($catalogue); $catalogue = CatalogueService::GetByName($name); for ($i = 0; $i < count($attribute); $i++) { $value = new CatalogueAttribute(); $value->catalogue_id = $catalogue->catalogue_id; $value->attribute_id = AttributeService::GetByName(trim($attribute[$i]))->attribute_id; CatalogueAttributeService::Create($value); } header("Location: /Catalog/Item"); }