Error: Call to a member function getPath() on null: Call to a member function getPath() on null