/**
* Todo rewrite this horrobile piece of code...
* @param $tableName
* @return bool|string
*/
private function determineCacheId($tableName)
{
/** @var string|bool $compTableName */
if ($tableName instanceof DefinitionInterface) {
return $tableName->getTableName();
}
if (null === $tableName) {
return false;
}
if (is_string($tableName)) {
return class_exists($tableName) && false === Support::isPHPInternalClass($tableName) ? Inflector::pluralize(Inflector::tableize(Support::getCachedReflectionClass($tableName, $this->getReflectionCache())->getShortName())) : $tableName;
}
if (is_array($tableName)) {
return false;
}
if (Support::isPHPInternalClass($tableName)) {
return false;
}
if ($tableName instanceof EntityAwareInterface) {
$compTableName = Inflector::pluralize(Inflector::tableize(Support::getCachedReflectionClass(Support::getEntityName($tableName->getEntity()), $this->getReflectionCache())->getShortName()));
if (is_string($compTableName)) {
return $compTableName;
}
}
if (is_object($tableName)) {
$compTableName = Inflector::pluralize(Inflector::tableize(Support::getCachedReflectionClass(Support::getEntityName($tableName), $this->getReflectionCache())->getShortName()));
if (is_string($compTableName)) {
return $compTableName;
}
}
return false;
}