<?php

class Info
{
    function getUsername($id)
    {
        $sql = "SELECT username FROM user WHERE id=" . (int)$id;
        $result = mysql_fetch_array(mysql_query($sql));

        return $result[0];
    }
}
 
<?php

class Info
{
    function getUsername($id)
    {
        global $container;
        $userRepository = $container->get('acme.demo.repository.user');
        $user = $userRepository->find($id);

        return $user->getUsername();
    }
}
 
Use UserRepository in legacy side
Use UserRepository in legacy side
