2006 hyundai santa fe stalling issues

Hello, I have a 2006 mrk 2 hyundai santa fe 2.0 ltr diesel automatic. The problem I've been having as of late is. The car has stalled out four times now and won't start straight away after doing so.  Now the check engine light has come on.any help would be greatly appreciated. The car hasn't run out of fuel when it has stalled and has had half a tank of fuel or better when it has stalled.