Call to a member function getCategoryId() on null