modified to conform with needs

modified constants instead of values
avoid deprecated method getEntityManager()
use Doctrine Common Registry