private function checkEntity($entity) { if (get_class($entity) !== get_class($this->getDefinition()->getEntity())) { throw new \InvalidArgumentException('Disallowed usage of differing entity!' . get_class($entity)); } return $this; }