protected function createInstanceOf($registry, $type, $row = null) { $handler = $registry->getTypeHandler($type); if ($handler !== null) { return $handler->createNewInstance($row); } else { return $registry->createInstanceOf($type); } }