eZ\Publish\Core\Persistence\Legacy\Content\ObjectState\Mapper::createObjectStateGroupFromInputStruct PHP Метод

createObjectStateGroupFromInputStruct() публичный Метод

Creates an instance of ObjectStateGroup object from provided $input struct.
public createObjectStateGroupFromInputStruct ( eZ\Publish\SPI\Persistence\Content\ObjectState\InputStruct $input ) : eZ\Publish\SPI\Persistence\Content\ObjectState\Group
$input eZ\Publish\SPI\Persistence\Content\ObjectState\InputStruct
Результат eZ\Publish\SPI\Persistence\Content\ObjectState\Group
    public function createObjectStateGroupFromInputStruct(InputStruct $input)
    {
        $objectStateGroup = new Group();
        $objectStateGroup->identifier = $input->identifier;
        $objectStateGroup->defaultLanguage = $input->defaultLanguage;
        $objectStateGroup->name = $input->name;
        $objectStateGroup->description = $input->description;
        $objectStateGroup->languageCodes = array();
        foreach ($input->name as $languageCode => $name) {
            $objectStateGroup->languageCodes[] = $languageCode;
        }
        return $objectStateGroup;
    }

Usage Example

Пример #1
0
 /**
  * Updates an object state group
  *
  * @param mixed $groupId
  * @param \eZ\Publish\SPI\Persistence\Content\ObjectState\InputStruct $input
  *
  * @return \eZ\Publish\SPI\Persistence\Content\ObjectState\Group
  */
 public function updateGroup($groupId, InputStruct $input)
 {
     $objectStateGroup = $this->objectStateMapper->createObjectStateGroupFromInputStruct($input);
     $objectStateGroup->id = (int) $groupId;
     $this->objectStateGateway->updateObjectStateGroup($objectStateGroup);
     return $this->loadGroup($objectStateGroup->id);
 }