Fatal error: Call to a member function setDisplayName() on a non-object

The methods of the UserEntityClass didn't return the UserEntityClass object. At least with the version I've used.