src/DataStore/src/DataStore/Aspect/AspectTyped.php
protected function dtoToArray(BaseDto $dto)
    {
        $itemData = [];

        foreach ($this->scheme as $fieldName => $fieldInfo) {
            $getter = 'get' . ucfirst($fieldName);

            if (!method_exists($dto, $getter)) {
                throw new RuntimeException("Undefined method '$getter' in " . get_class($dto));
            }

            /** @var FormatterInterface $formatter */
            $formatter = $this->formatterPluginManager->get($fieldInfo['formatter']);

            $itemData[$fieldName] = $formatter->format($dto->$getter());
        }

        return $itemData;
    }
protected function dtoToArray(BaseDto $dto)
    {
        $itemData = [];

        foreach ($this->scheme as $fieldName => $fieldInfo) {
            $getter = 'get' . ucfirst($fieldName);

            if (!method_exists($dto, $getter)) {
                throw new RuntimeException("Undefined method '$getter' in " . get_class($dto));
            }

            /** @var FormatterInterface $formatter */
            $formatter = $this->formatterPluginManager->get($fieldInfo['formatter']);

            $itemData[$fieldName] = $formatter->format($dto->$getter());
        }

        return $itemData;
    }
protected function dtoToArray ( BaseDto $ dto ) { $ itemData = [ ] ; foreach ( $ this -> scheme as $ fieldName => $ fieldInfo ) { $ getter = 'get' . ucfirst ( $ fieldName ) ; if ( ! method_exists ( $ dto , $ getter ) ) { throw new RuntimeException ( "Undefined method '$getter' in " . get_class ( $ dto ) ) ; } /** @var FormatterInterface $formatter */ $ formatter = $ this -> formatterPluginManager -> get ( $ fieldInfo [ 'formatter' ] ) ; $ itemData [ $ fieldName ] = $ formatter -> format ( $ dto -> $ getter ( ) ) ; } return $ itemData ; }
Convert BaseDto object to array

@param BaseDto $dto
@return array
Convert BaseDto object to array