当前位置: 首页>>代码示例>>PHP>>正文


PHP core_kernel_classes_Class::getProperties方法代码示例

本文整理汇总了PHP中core_kernel_classes_Class::getProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP core_kernel_classes_Class::getProperties方法的具体用法?PHP core_kernel_classes_Class::getProperties怎么用?PHP core_kernel_classes_Class::getProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core_kernel_classes_Class的用法示例。


在下文中一共展示了core_kernel_classes_Class::getProperties方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPropertiesByClass

 protected function getPropertiesByClass(\core_kernel_classes_Class $type)
 {
     if (!isset($this->propertyCache[$type->getUri()])) {
         $this->propertyCache[$type->getUri()] = $type->getProperties(true);
         // alternativly use non recursiv and union with getPropertiesByClass of parentclasses
     }
     return $this->propertyCache[$type->getUri()];
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:8,代码来源:SearchTokenGenerator.php

示例2: deleteClass

 /**
  * Delete a subclass
  *
  * @access public
  * @author Joel Bout, <joel@taotesting.com>
  * @param core_kernel_classes_Class $clazz            
  * @return boolean
  */
 public function deleteClass(core_kernel_classes_Class $clazz)
 {
     $returnValue = (bool) false;
     if ($clazz->isSubClassOf($this->getRootClass()) && !$clazz->equals($this->getRootClass())) {
         $returnValue = true;
         $subclasses = $clazz->getSubClasses(false);
         foreach ($subclasses as $subclass) {
             $returnValue = $returnValue && $this->deleteClass($subclass);
         }
         foreach ($clazz->getProperties() as $classProperty) {
             $returnValue = $returnValue && $this->deleteClassProperty($classProperty);
         }
         $returnValue = $returnValue && $clazz->delete();
     } else {
         common_Logger::w('Tried to delete class ' . $clazz->getUri() . ' as if it were a subclass of ' . $this->getRootClass()->getUri());
     }
     return (bool) $returnValue;
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:26,代码来源:class.ClassService.php

示例3: testModel

 public function testModel()
 {
     // We must have a property dedicated to Roles in the Generis User class.
     $userClass = new core_kernel_classes_Class(CLASS_GENERIS_USER);
     $this->assertTrue($userClass->exists());
     // The userClass must have a dedicated userRoles property.
     $this->assertTrue(array_key_exists(PROPERTY_USER_ROLES, $userClass->getProperties()));
     // The class that gather all Roles instances together must exist.
     $roleClass = new core_kernel_classes_Class(CLASS_ROLE);
     $this->assertTrue($roleClass->exists());
     // The Role class must have the right properties (isSystem and includesRole)
     $roleClassProperties = $roleClass->getProperties();
     $this->assertTrue(array_key_exists(PROPERTY_ROLE_ISSYSTEM, $roleClassProperties));
     $this->assertTrue(array_key_exists(PROPERTY_ROLE_INCLUDESROLE, $roleClassProperties));
     // The Generis Role must exist after installation.
     $generisRole = new core_kernel_classes_Resource(INSTANCE_ROLE_GENERIS);
     $this->assertTrue($generisRole->exists());
 }
开发者ID:nagyist,项目名称:generis,代码行数:18,代码来源:UserServiceTest.php

示例4: getPropertyProperties

 /**
  * Get the properties of the rdfs Property class
  *
  * @access public
  * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu>
  * @param  string mode
  * @return array
  */
 public static function getPropertyProperties($mode = 'simple')
 {
     $returnValue = array();
     switch ($mode) {
         case 'simple':
             $defaultUris = array(PROPERTY_IS_LG_DEPENDENT);
             break;
         case 'advanced':
         default:
             $defaultUris = array(RDFS_LABEL, PROPERTY_WIDGET, RDFS_RANGE, PROPERTY_IS_LG_DEPENDENT);
             break;
     }
     $resourceClass = new core_kernel_classes_Class(RDF_PROPERTY);
     foreach ($resourceClass->getProperties() as $property) {
         if (in_array($property->getUri(), $defaultUris)) {
             array_push($returnValue, $property);
         }
     }
     return (array) $returnValue;
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:28,代码来源:class.GenerisFormFactory.php

示例5: removeClassProperty

 /**
  * Render the add property sub form.
  * @throws Exception
  * @return void
  * @requiresRight classUri WRITE
  */
 public function removeClassProperty()
 {
     $success = false;
     if (!tao_helpers_Request::isAjax()) {
         throw new Exception("wrong request mode");
     }
     $class = new core_kernel_classes_Class($this->getRequestParameter('classUri'));
     $property = new core_kernel_classes_Property($this->getRequestParameter('uri'));
     //delete property mode
     foreach ($class->getProperties() as $classProperty) {
         if ($classProperty->equals($property)) {
             $indexes = $property->getPropertyValues(new core_kernel_classes_Property(INDEX_PROPERTY));
             //delete property and the existing values of this property
             if ($property->delete(true)) {
                 //delete index linked to the property
                 foreach ($indexes as $indexUri) {
                     $index = new core_kernel_classes_Resource($indexUri);
                     $index->delete(true);
                 }
                 $success = true;
                 break;
             }
         }
     }
     if ($success) {
         return $this->returnJson(array('success' => true));
     } else {
         $this->returnError(__('Unable to remove the property.'));
     }
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:36,代码来源:class.PropertiesAuthoring.php

示例6: getIndexesByClass

 /**
  * Get the Search Indexes of a given $class.
  * 
  * The returned array is an associative array where keys are the Property URI
  * the Search Index belongs to, and the values are core_kernel_classes_Resource objects
  * corresponding to Search Index definitions.
  * 
  * @param \core_kernel_classes_Class $class
  * @param boolean $recursive Whether or not to look for Search Indexes that belong to sub-classes of $class. Default is true.
  * @return Index[] An array of Search Index to $class.
  */
 public static function getIndexesByClass(\core_kernel_classes_Class $class, $recursive = true)
 {
     $returnedIndexes = array();
     // Get properties to the root class hierarchy.
     $properties = $class->getProperties(true);
     foreach ($properties as $prop) {
         $propUri = $prop->getUri();
         $indexes = self::getIndexes($prop);
         if (count($indexes) > 0) {
             if (isset($returnedIndexes[$propUri]) === false) {
                 $returnedIndexes[$propUri] = array();
             }
             foreach ($indexes as $index) {
                 $returnedIndexes[$propUri][] = new Index($index->getUri());
             }
         }
     }
     return $returnedIndexes;
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:30,代码来源:IndexService.php

示例7: toArray

 /**
  * Format an RDFS Class to an array
  *
  * @access public
  * @author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
  * @param  Class clazz
  * @return array
  */
 public function toArray(core_kernel_classes_Class $clazz)
 {
     $returnValue = array();
     $properties = $clazz->getProperties(false);
     foreach ($clazz->getInstances(false) as $instance) {
         $data = array();
         foreach ($properties as $property) {
             $data[$property->getLabel()] = null;
             $values = $instance->getPropertyValues($property);
             if (count($values) > 1) {
                 $data[$property->getLabel()] = $values;
             } elseif (count($values) == 1) {
                 $data[$property->getLabel()] = $values[0];
             }
         }
         array_push($returnValue, $data);
     }
     return (array) $returnValue;
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:27,代码来源:class.GenerisService.php

示例8: testGetProperties

 public function testGetProperties()
 {
     $list = new core_kernel_classes_Class(RDF_LIST);
     $properties = $list->getProperties();
     $this->assertTrue(count($properties) == 2);
     $expectedResult = array(RDF_FIRST, RDF_REST);
     foreach ($properties as $property) {
         $this->assertTrue($property instanceof core_kernel_classes_Property);
         $this->assertTrue(in_array($property->getUri(), $expectedResult));
         if ($property->getUri() === RDF_FIRST) {
             $this->assertEquals($property->getRange()->getUri(), RDFS_RESOURCE);
             $this->assertEquals($property->getLabel(), 'first');
             $this->assertEquals($property->getComment(), 'The first item in the subject RDF list.');
         }
         if ($property->getUri() === RDF_REST) {
             $this->assertEquals($property->getRange()->getUri(), RDF_LIST);
             $this->assertEquals($property->getLabel(), 'rest');
             $this->assertEquals($property->getComment(), 'The rest of the subject RDF list after the first item.');
         }
     }
     $class = $list->createSubClass('toto', 'toto');
     $properties2 = $class->getProperties(true);
     $this->assertFalse(empty($properties2));
     $class->delete();
 }
开发者ID:oat-sa,项目名称:generis,代码行数:25,代码来源:ClassTest.php


注:本文中的core_kernel_classes_Class::getProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。