Call to a member function getSchemaCollection() on null

It looks like CakePHP 2 code. It can work with CakePHP 3, but you can not be sure how long. So it is better to refactor it for CakePHP 3