The SELECT NEW dql query of Doctrine

Code
<?php

use PHPSnippets\Db\Entity\Test;

class 
Foo
{
    private 
$number;
    private 
$name;
    
    public function 
__construct(int $idstring $name)
    {
        
$this->number $id 1000;
        
$this->name $name 'ly';
    }
}

$result $entityManager->createQuery(
    
'SELECT NEW Foo(test.id, test.name) FROM '.Test::class.' test'
)->getResult();

dump($result);
Result
array:3 [
0 => Foo {#355
-number: 1000
-name: "fooly"
}
1 => Foo {#390
-number: 2000
-name: "testly"
}
2 => Foo {#360
-number: 3000
-name: "barly"
}
]