php repository pattern to manage connection between data source and entity