public function getDocumentTypesAction() { $documentTypes = Document::getTypes(); $typeItems = []; foreach ($documentTypes as $documentType) { $typeItems[] = ["text" => $documentType]; } $this->_helper->json($typeItems); }
<?php $db = \Pimcore\Db::get(); $types = \Pimcore\Model\Document::getTypes(); $types[] = "printpage"; $types[] = "printcontainer"; $types = array_unique($types); $db->query("\n ALTER TABLE documents\n CHANGE type type ENUM('" . implode("', '", $types) . "');\n"); // add missing indexes $db->query("CREATE TABLE IF NOT EXISTS `documents_printpage` (\n `id` int(11) unsigned NOT NULL DEFAULT '0',\n `module` varchar(255) DEFAULT NULL,\n `controller` varchar(255) DEFAULT NULL,\n `action` varchar(255) DEFAULT NULL,\n `template` varchar(255) DEFAULT NULL,\n `lastGenerated` int(11) DEFAULT NULL,\n `lastGenerateMessage` text CHARACTER SET utf8,\n PRIMARY KEY (`id`)\n) DEFAULT CHARSET=utf8;\n");
/** * @param $type * @return bool */ public static function isValidType($type) { return in_array($type, Document::getTypes()); }