Call to a member function getHistoryByType() on null