Same behavior for 2.3 and 2.4

Finally use the same way for each doctrine version