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


PHP core_kernel_classes_Class::exists方法代码示例

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


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

示例1: testCreateSubClassOf

 public function testCreateSubClassOf()
 {
     $this->hardify();
     $this->createData();
     $classProxy = ClassProxy::singleton();
     // Any new subclass of an hardified class must be hardified as well.
     $this->targetSongClass = $this->targetWorkClass->createSubClass('Song', 'The Song Class');
     $this->assertTrue($this->targetSongClass->exists());
     $this->assertIsA($classProxy->getImpToDelegateTo($this->targetSongClass), 'oat\\generisHard\\models\\hardsql\\Clazz');
 }
开发者ID:nagyist,项目名称:extension-generis-hard,代码行数:10,代码来源:HardImplTest.php

示例2: __invoke

 /**
  * Call to launch export method of exporter
  *
  * php index.php 'oat\taoQtiItem\model\flyExporter\ExporterAction' $uri
  *
  * @param $params $params[0] is optional uri parameter
  * @return \common_report_Report
  */
 public function __invoke($params)
 {
     try {
         \common_ext_ExtensionsManager::singleton()->getExtensionById('taoItems');
         $exporterService = $this->getServiceManager()->get(SimpleExporter::SERVICE_ID);
         $uri = isset($params[0]) ? $params[0] : null;
         if (!is_null($uri)) {
             $class = new \core_kernel_classes_Class($uri);
             if ($class->exists()) {
                 $items = $class->getInstances(true);
             } else {
                 throw new \Exception("Exporter needs a valid class uri.");
             }
         }
         $filename = $exporterService->export(isset($items) ? $items : $uri);
         return new \common_report_Report(\common_report_Report::TYPE_SUCCESS, "\nExport end.\nCSV export is located at: " . $filename . "\n");
     } catch (\Exception $e) {
         \common_Logger::w('Error during item metadata export: ' . $e->getMessage());
         return new \common_report_Report(\common_report_Report::TYPE_ERROR, "\n" . $e->getMessage() . "\n");
     }
 }
开发者ID:oat-sa,项目名称:extension-tao-itemqti,代码行数:29,代码来源:ExporterAction.php

示例3: testClearRoles

 public function testClearRoles()
 {
     $prefix = LOCAL_NAMESPACE . '#';
     $roleUris = array($prefix . 'baseRole', $prefix . 'subRole1', $prefix . 'subRole2', $prefix . 'subRole3', $prefix . 'subRole11', $prefix . 'subRole12', $prefix . 'subRole13');
     foreach ($roleUris as $ru) {
         $r = new core_kernel_classes_Class($ru);
         $r->delete(true);
         $this->assertFalse($r->exists());
     }
 }
开发者ID:nagyist,项目名称:generis,代码行数:10,代码来源:UserServiceTest.php

示例4: testDelete

 /**
  * @depends testAdd
  */
 public function testDelete($returnedLink)
 {
     $this->fileManagerMock->expects($this->once())->method('deleteFile')->with('myGreatLink')->willReturn(true);
     $instance = new \core_kernel_classes_Resource($returnedLink);
     $this->assertInstanceOf('\\core_kernel_classes_Resource', $instance, 'This class should exists');
     $success = $this->mediaManagerManagement->delete($returnedLink);
     // should return true
     $this->assertTrue($success, 'The file is not deleted');
     // should remove the instance
     $removedInstance = new \core_kernel_classes_Class($instance->getUri());
     $this->assertFalse($instance->exists(), 'The instance still exists');
     $this->assertFalse($removedInstance->exists(), 'The instance still exists');
 }
开发者ID:nagyist,项目名称:extension-tao-mediamanager,代码行数:16,代码来源:MediaManagerManagementTest.php

示例5: getOrCreatePath

 /**
  * 
  * @param string $path
  * @return \core_kernel_classes_Class
  */
 private function getOrCreatePath($path)
 {
     if ($path === '') {
         $clazz = $this->getRootClass();
     } else {
         $clazz = new \core_kernel_classes_Class(\tao_helpers_uri::decode($path));
         if (!$clazz->isSubClassOf($this->getRootClass()) && !$clazz->equals($this->getRootClass()) && !$clazz->exists()) {
             // consider $path to be a label
             $found = false;
             foreach ($this->getRootClass()->getSubClasses() as $subclass) {
                 if ($subclass->getLabel() === $path) {
                     $found = true;
                     $clazz = $subclass;
                     break;
                 }
             }
             if (!$found) {
                 $clazz = $this->getRootClass()->createSubClass($path);
             }
         }
     }
     return $clazz;
 }
开发者ID:nagyist,项目名称:extension-tao-mediamanager,代码行数:28,代码来源:MediaSource.php

示例6: testCreateUnits

 public function testCreateUnits()
 {
     set_time_limit(300);
     $this->itemClass = null;
     $this->units = array();
     $this->properties = array();
     $this->files = array();
     $classUri = LOCAL_NAMESPACE . '#TranslationItemsClass';
     $translationClass = new core_kernel_classes_Class($classUri);
     if (!$translationClass->exists()) {
         $itemClass = new core_kernel_classes_Class(TAO_ITEM_CLASS);
         $translationClass = $itemClass->createSubClass('Translation Items', 'created for translation process execution test case', $classUri);
         $this->assertIsA($translationClass, 'core_kernel_classes_Class');
     }
     $this->itemClass = $translationClass;
     foreach ($this->unitNames as $unitName) {
         //create unit:
         $this->units[$unitName] = $translationClass->createInstance($unitName, 'created for translation process execution test case');
         $this->assertNotNull($this->units[$unitName]);
     }
     //		var_dump($this->units, $this->properties, $this->files);
 }
开发者ID:nagyist,项目名称:extension-tao-wfengine,代码行数:22,代码来源:TranslationProcessExecutionTestCase.php

示例7: deleteInstances

 /**
  * (non-PHPdoc)
  * @see core_kernel_persistence_ClassInterface::deleteInstances()
  */
 public function deleteInstances(core_kernel_classes_Class $resource, $resources, $deleteReference = false)
 {
     $returnValue = false;
     $class = new core_kernel_classes_Class($resource->getUri());
     $uris = array();
     foreach ($resources as $r) {
         $uri = $r instanceof core_kernel_classes_Resource ? $r->getUri() : $r;
         $uris[] = $this->getPersistence()->quote($uri);
     }
     if ($class->exists()) {
         $inValues = implode(',', $uris);
         $query = 'DELETE FROM statements WHERE subject IN (' . $inValues . ')';
         if (true === $deleteReference) {
             $params[] = $resource->getUri();
             $query .= ' OR object IN (' . $inValues . ')';
         }
         try {
             // Even if now rows are affected, we consider the resources
             // as deleted.
             $this->getPersistence()->exec($query);
             $returnValue = true;
         } catch (PDOException $e) {
             throw new core_kernel_persistence_smoothsql_Exception("An error occured while deleting resources: " . $e->getMessage());
         }
     }
     return $returnValue;
 }
开发者ID:nagyist,项目名称:generis,代码行数:31,代码来源:class.Class.php


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