protected function fetchUserNodeTypes()
{
$result = array();
$query = "SELECT * FROM phpcr_type_nodes";
foreach ($this->getConnection()->fetchAll($query) as $data) {
$name = $data['name'];
$result[$name] = array('name' => $name, 'isAbstract' => (bool) $data['is_abstract'], 'isMixin' => (bool) $data['is_mixin'], 'isQueryable' => (bool) $data['queryable'], 'hasOrderableChildNodes' => (bool) $data['orderable_child_nodes'], 'primaryItemName' => $data['primary_item'], 'declaredSuperTypeNames' => array_filter(explode(' ', $data['supertypes'])), 'declaredPropertyDefinitions' => array(), 'declaredNodeDefinitions' => array());
$query = 'SELECT * FROM phpcr_type_props WHERE node_type_id = ?';
$props = $this->getConnection()->fetchAll($query, array($data['node_type_id']));
foreach ($props as $propertyData) {
$result[$name]['declaredPropertyDefinitions'][] = array('declaringNodeType' => $data['name'], 'name' => $propertyData['name'], 'isAutoCreated' => (bool) $propertyData['auto_created'], 'isMandatory' => (bool) $propertyData['mandatory'], 'isProtected' => (bool) $propertyData['protected'], 'onParentVersion' => $propertyData['on_parent_version'], 'requiredType' => (int) $propertyData['required_type'], 'multiple' => (bool) $propertyData['multiple'], 'isFulltextSearchable' => (bool) $propertyData['fulltext_searchable'], 'isQueryOrderable' => (bool) $propertyData['query_orderable'], 'queryOperators' => array(0 => 'jcr.operator.equal.to', 1 => 'jcr.operator.not.equal.to', 2 => 'jcr.operator.greater.than', 3 => 'jcr.operator.greater.than.or.equal.to', 4 => 'jcr.operator.less.than', 5 => 'jcr.operator.less.than.or.equal.to', 6 => 'jcr.operator.like'), 'defaultValues' => array($propertyData['default_value']));
}
$query = 'SELECT * FROM phpcr_type_childs WHERE node_type_id = ?';
$childs = $this->getConnection()->fetchAll($query, array($data['node_type_id']));
foreach ($childs as $childData) {
$result[$name]['declaredNodeDefinitions'][] = array('declaringNodeType' => $data['name'], 'name' => $childData['name'], 'isAutoCreated' => (bool) $childData['auto_created'], 'isMandatory' => (bool) $childData['mandatory'], 'isProtected' => (bool) $childData['protected'], 'onParentVersion' => $childData['on_parent_version'], 'allowsSameNameSiblings' => false, 'defaultPrimaryTypeName' => $childData['default_type'], 'requiredPrimaryTypeNames' => array_filter(explode(" ", $childData['primary_types'])));
}
}
return $result;
}