[SOLVED] How to migrate DQL-Query from Flow 2.x to Flow 7.x?

Hi,

can you tell how these lines of code are implemented in Flow 7.x?.

....

use TYPO3\Flow\Persistence\QueryInterface; //#=> use Neos\Flow\Persistence\QueryInterface; 
use TYPO3\Flow\Annotations as Flow; //#=> use Neos\Flow\Annotations as Flow;  
use TYPO3\Flow\Persistence\Repository; //#=> use Neos\Flow\Persistence\Doctrine\Repository  

/**
 * A repository for something
 *
 * @Flow\Scope("singleton")
 */
class SomeRepository extends  Repository {

	/**
	 * @Flow\Inject
	 * @var \Doctrine\Common\Persistence\ObjectManager
	 */
	protected $entityManager;  
	
	
Public function getData() {
	
		$dql="SELECT x FROM \....";
		$query = $this->entityManager->createQuery($dql) ;
		return $query->execute();
}	

...
}

The namespace of the EntityManager was changed to Doctrine\ORM - beside that, nothing seems to have changed.

Did you try and encountered a error or asking before starting the migration?

Thank you
@var \Doctrine\ORM\EntityManagerInterface
did it!

1 Like