eZ\Publish\Core\Persistence\Legacy\Content\Mapper::extractContentInfoFromRow PHP Method

extractContentInfoFromRow() public method

Extracts a ContentInfo object from $row.
public extractContentInfoFromRow ( array $row, string $prefix = '', string $treePrefix = 'ezcontentobject_tree_' ) : eZ\Publish\SPI\Persistence\Content\ContentInfo
$row array
$prefix string Prefix for row keys, which are initially mapped by ezcontentobject fields
$treePrefix string Prefix for tree row key, which are initially mapped by ezcontentobject_tree_ fields
return eZ\Publish\SPI\Persistence\Content\ContentInfo
    public function extractContentInfoFromRow(array $row, $prefix = '', $treePrefix = 'ezcontentobject_tree_')
    {
        $contentInfo = new ContentInfo();
        $contentInfo->id = (int) $row["{$prefix}id"];
        $contentInfo->name = $row["{$prefix}name"];
        $contentInfo->contentTypeId = (int) $row["{$prefix}contentclass_id"];
        $contentInfo->sectionId = (int) $row["{$prefix}section_id"];
        $contentInfo->currentVersionNo = (int) $row["{$prefix}current_version"];
        $contentInfo->isPublished = (bool) ($row["{$prefix}status"] == ContentInfo::STATUS_PUBLISHED);
        $contentInfo->ownerId = (int) $row["{$prefix}owner_id"];
        $contentInfo->publicationDate = (int) $row["{$prefix}published"];
        $contentInfo->modificationDate = (int) $row["{$prefix}modified"];
        $contentInfo->alwaysAvailable = (int) $row["{$prefix}language_mask"] & 1;
        $contentInfo->mainLanguageCode = $this->languageHandler->load($row["{$prefix}initial_language_id"])->languageCode;
        $contentInfo->remoteId = $row["{$prefix}remote_id"];
        $contentInfo->mainLocationId = $row["{$treePrefix}main_node_id"] !== null ? (int) $row["{$treePrefix}main_node_id"] : null;
        return $contentInfo;
    }

Usage Example

コード例 #1
0
 /**
  * @covers eZ\Publish\Core\Persistence\Legacy\Content\Mapper::extractContentInfoFromRow
  * @dataProvider extractContentInfoFromRowProvider
  *
  * @param array $fixtures
  * @param string $prefix
  */
 public function testExtractContentInfoFromRow(array $fixtures, $prefix)
 {
     $contentInfoReference = $this->getContentExtractReference()->versionInfo->contentInfo;
     $mapper = new Mapper($this->getValueConverterRegistryMock(), $this->getLanguageHandler());
     self::assertEquals($contentInfoReference, $mapper->extractContentInfoFromRow($fixtures, $prefix));
 }
All Usage Examples Of eZ\Publish\Core\Persistence\Legacy\Content\Mapper::extractContentInfoFromRow