src/Entity/DataTransferObjects/DtoFactory.php
public function createDtoFromEntity(EntityInterface $entity)
    {
        $this->resetCreationTransaction();
        $dsm     = $entity::getDoctrineStaticMeta();
        $dtoFqn  = $this->namespaceHelper->getEntityDtoFqnFromEntityFqn($dsm->getReflectionClass()->getName());
        $dto     = new $dtoFqn();
        $setters = $dsm->getSetters();
        foreach ($setters as $getterName => $setterName) {
            $dto->$setterName($entity->$getterName());
        }

        return $dto;
    }
public function createDtoFromEntity(EntityInterface $entity)
    {
        $this->resetCreationTransaction();
        $dsm     = $entity::getDoctrineStaticMeta();
        $dtoFqn  = $this->namespaceHelper->getEntityDtoFqnFromEntityFqn($dsm->getReflectionClass()->getName());
        $dto     = new $dtoFqn();
        $setters = $dsm->getSetters();
        foreach ($setters as $getterName => $setterName) {
            $dto->$setterName($entity->$getterName());
        }

        return $dto;
    }
public function createDtoFromEntity ( EntityInterface $ entity ) { $ this -> resetCreationTransaction ( ) ; $ dsm = $ entity :: getDoctrineStaticMeta ( ) ; $ dtoFqn = $ this -> namespaceHelper -> getEntityDtoFqnFromEntityFqn ( $ dsm -> getReflectionClass ( ) -> getName ( ) ) ; $ dto = new $ dtoFqn ( ) ; $ setters = $ dsm -> getSetters ( ) ; foreach ( $ setters as $ getterName => $ setterName ) { $ dto -> $ setterName ( $ entity -> $ getterName ( ) ) ; } return $ dto ; }
Create a DTO with the values from teh Entity, optionally with some values directly overridden with your values
to set

@param EntityInterface $entity

@return mixed
Create a DTO with the values from teh Entity optionally with some values directly overridden with your values to set