[*] Classes : improve performances of "Feature detachable" feature
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8754 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -905,4 +905,21 @@ abstract class ObjectModelCore
|
||||
|
||||
return isset($row['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is allow to know if a entity is currently used
|
||||
* @since 1.5.0.1
|
||||
* @param string $table name of table linked to entity
|
||||
* @param bool $has_active_column true if the table has an active column
|
||||
* @return bool
|
||||
*/
|
||||
public static function isCurrentlyUsed($table, $has_active_column = false)
|
||||
{
|
||||
$query = new DbQuery();
|
||||
$query->select('`id_'.pSQL($table).'`');
|
||||
$query->from(pSQL($table));
|
||||
if ($has_active_column)
|
||||
$query->where('`active` = 1');
|
||||
return (bool)Db::getInstance()->getValue($query);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user