Under certain circumstances, such as when handling unsaved yet entities, the source may have not been set yet. The getSource() should be handling this gracefully to avoid fatal PHP errors.
getSource()
Active
1.0
Code