Remove usage of deprecated Entity methods

This includes fixing two of the issues listed here
https://gerrit.wikimedia.org/r/#/c/173724/1/lib/includes/store/sql/TermSqlIndex.php

Change-Id: I42b15469d765d40c5db21b1fc956141bcb0b0a75
Merge "Remove usage of deprecated Entity methods"