protected function createEntity(DibiRow $dibiRow, $entityClass = null, $table = null)
{
if ($table === null) {
$table = $this->getTable();
}
$result = Result::createInstance($dibiRow, $table, $this->connection, $this->mapper);
$primaryKey = $this->mapper->getPrimaryKey($table);
$row = $result->getRow($dibiRow->{$primaryKey});
if ($entityClass === null) {
$entityClass = $this->mapper->getEntityClass($table, $row);
}
$entity = $this->entityFactory->createEntity($entityClass, $row);
$entity->makeAlive($this->entityFactory);
return $entity;
}