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


PHP eZSection::fetchByIdentifier方法代码示例

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


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

示例1: testFetchByIdentifier

 /**
  * test fetchByIdentifier function
  */
 public function testFetchByIdentifier()
 {
     global $eZContentSectionObjectCache;
     $section = new eZSection(array());
     $section->setAttribute('name', 'Test Section');
     $section->setAttribute('identifier', 'test_section');
     $section->store();
     $sectionID = $section->attribute('id');
     // assert that if the cache is set after fetching
     $section2 = eZSection::fetchByIdentifier('test_section');
     $this->assertEquals($sectionID, $section2->attribute('id'));
     // assert that object is cached
     $this->assertNotNull($eZContentSectionObjectCache['test_section']);
     $this->assertNotNull($eZContentSectionObjectCache[$sectionID]);
     // assert that the two object refer to same object
     $this->assertSame($eZContentSectionObjectCache[$sectionID], $section2);
     $this->assertSame(eZSection::fetch($sectionID), $section2);
     // fetchByID and fetchByIdentifier, assert that the result is the same
     $section3 = new eZSection(array());
     $section3->setAttribute('name', 'Test Section3');
     $section3->setAttribute('identifier', 'test_section3');
     $section3->store();
     $objectByID = eZSection::fetch($section3->attribute('id'));
     $objectByIdentifier = eZSection::fetchByIdentifier('test_section3');
     $this->assertSame($objectByID, $objectByIdentifier);
     $arrayByIdentifier = eZSection::fetch($section3->attribute('id'), false);
     $this->assertTrue(is_array($arrayByIdentifier));
 }
开发者ID:rmiguel,项目名称:ezpublish,代码行数:31,代码来源:ezsection_test.php

示例2: fetchSectionObject

 /**
  * Fetch section object given either section id or section identifier. There should be one and only one parameter.
  * @param integer $sectionID
  * @param string $sectionIdentifier
  * @return object
  */
 function fetchSectionObject( $sectionID = false, $sectionIdentifier = false )
 {
     if( $sectionID !== false )
     {
         if( $sectionIdentifier !== false )
         {
             $sectionObject = null;
         }
         else
         {
             $sectionObject = eZSection::fetch( $sectionID );
         }
     }
     else
     {
         if( $sectionIdentifier === false )
         {
             $sectionObject = null;
         }
         else
         {
             $sectionObject = eZSection::fetchByIdentifier( $sectionIdentifier );
         }
     }
     if ( $sectionObject === null )
         return array( 'error' => array( 'error_type' => 'kernel',
                                         'error_code' => eZError::KERNEL_NOT_FOUND ) );
     return array( 'result' => $sectionObject );
 }
开发者ID:nottavi,项目名称:ezpublish,代码行数:35,代码来源:ezsectionfunctioncollection.php

示例3: execute

    function execute( $xmlNode )
    {
        // ezcontentnavigationpart
        $sectionName    = $xmlNode->getAttribute( 'sectionName' );
        $sectionIdentifier    = $xmlNode->getAttribute( 'sectionIdentifier' );
        $navigationPart = $xmlNode->getAttribute( 'navigationPart' );
        $referenceID    = $xmlNode->getAttribute( 'referenceID' );

        if( $sectionIdentifier )
        {
            $sectionID = eZSection::fetchByIdentifier( $sectionIdentifier );
        }

        if( !$sectionID )
        {
            $sectionID = $this->sectionIDbyName( $sectionName );
        }

        if( $sectionID )
        {
            $this->writeMessage( "\tSection '$sectionName' already exists." , 'notice' );
        }
        else
        {
            $section = new eZSection( array() );
            $section->setAttribute( 'name', $sectionName );
            $section->setAttribute( 'identifier', $sectionIdentifier );
            $section->setAttribute( 'navigation_part_identifier', $navigationPart );
            $section->store();
            $sectionID = $section->attribute( 'id' );
        }
        $refArray = array();
        if ( $referenceID )
        {
            $refArray[$referenceID] = $sectionID;
        }
        $this->addReference( $refArray );
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:38,代码来源:ezcreatesection.php

示例4: getLimitationValue

 /**
  * Returns a valid limitation value to be saved in database
  *
  * @since 1.2.0
  * @param string $limitationType	Limitation type
  * @param string $limitationValue	Human readable input value
  * @return string	Value to be saved in database
  */
 private function getLimitationValue($limitationType, $limitationValue)
 {
     $limitationValue = $this->getReferenceID($limitationValue);
     switch ($limitationType) {
         case 'Class':
         case 'ParentClass':
             if (!is_int($limitationValue)) {
                 $class = eZContentClass::fetchByIdentifier($limitationValue);
                 if ($class) {
                     $limitationValue = $class->ID;
                 }
             }
             break;
         case 'Subtree':
             //Subtree limitations need to store path_string instead of node_id
             $val = (int) $limitationValue;
             if ($val > 0) {
                 $node = eZContentObjectTreeNode::fetch($val);
                 $limitationValue = $node->attribute('path_string');
             }
             break;
         case 'SiteAccess':
             //siteaccess name must be crc32'd
             if (!is_int($limitationValue)) {
                 $limitationValue = eZSys::ezcrc32($limitationValue);
             }
             break;
         case 'Section':
             if (!is_int($limitationValue)) {
                 $section = eZSection::fetchByIdentifier($limitationValue);
                 if ($section) {
                     $limitationValue = $section->attribute('id');
                 }
             }
             break;
     }
     return $limitationValue;
 }
开发者ID:heliopsis,项目名称:ezxmlinstaller,代码行数:46,代码来源:ezcreaterole.php


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