use

return preg_replace("/^Ecamp(\w+)\\\\Repository\\\\(\w+)Repository$/", "Ecamp$1\\\\Entity\\\\$2", $repoName);

to ensure that it works also for other Modules then EcampCore.