public function create($parentId, $caption) { $tagCategory = new Type($this->getDataSource()); $tagCategory->setValue('parent_id', $parentId); $tagCategory->setValue('caption', $caption); $tagCategory->insert(); $rootCategory = new Type($this->getDataSource()); $rootCategory->loadBy('qname', 'default'); $tagCategory->buildTree($rootCategory->getId(), true); return $tagCategory->getValues(); }
echo "Create Content tag type\n"; $query = "\n INSERT INTO " . Type::getTableName() . " (\n parent_id,\n qname,\n caption,\n datecreation\n ) VALUES (\n " . $rootTypeNode->getId() . ",\n 'content',\n 'Contenu',\n NOW()\n )\n"; $tagDataSource->query($query); $tagTypeContent = new Type($tagDataSource); $tagTypeContent->loadBy('qname', 'content'); $tagTypeContent->setValue('data', '{ "attributes": { "image": { "caption": "Image", "mandatory": false, "type": "image", "default": null, "enable": true } }, "rules": [] }'); $tagTypeContent->update(); $tree = new Type(); $tree->setSource($tagDataSource); $tree->buildTree(); echo "Create root tag \n"; $contentTagType = new Type($tagDataSource); $contentTagType->loadBy('qname', 'default'); $tag = new Tag(); $tag->setSource($tagDataSource); $tag->setValue('type_id', $contentTagType->getId()); $tag->setCaption('Tags'); $tag->insert(); $tagDataSource->commit(); $tag->buildTree();
$tagDataSource->autocommit(false); $rootObjectType = new ObjectType($tagDataSource); $rootObjectType->loadBy('qname', 'default'); $rootObjectTypeId = $rootObjectType->getId(); echo "Create ezObject Object type\n"; $query = "\n INSERT INTO " . ObjectType::getTableName() . " (\n qname,\n caption,\n parent_id,\n datecreation\n ) VALUES (\n 'ezobject',\n 'Objet EzPublish',\n '" . $rootObjectTypeId . "',\n NOW()\n )\n"; $tagDataSource->query($query); echo "Construction de l'arbre des types d'objet\n"; $tree = new ObjectType(); $tree->setSource($tagDataSource); $tree->reset(); $tree->buildTree(); $contentTagType = new Type($tagDataSource); $contentTagType->loadBy('qname', 'content'); echo "Create Company tag type\n"; $contentTagId = $contentTagType->getId(); $query = "\n INSERT INTO " . Type::getTableName() . " (\n parent_id,\n qname,\n caption,\n datecreation,\n data\n ) VALUES (\n " . $contentTagId . ",\n 'company',\n 'Entreprise',\n NOW(),\n '" . '{ "attributes": { "isin": { "caption" : "Code ISIN", "mandatory": false, "type": "text", "default": null, "enable": true }, "listed": { "caption" : "Entreprise cotée", "mandatory": false, "type": "boolean", "default": false, "enable": true