Uncaught exception: Call to a member function getDefaults() on null