/**
     * @param string $categoryIdentifier
     * @param string $searchValue
     * @param string $sorts
     * @param int $limit
     * @return array
     */
    static public function fetchReferentialByIdentifierForAutoComplete( $categoryIdentifier, $searchValue, $sorts='asc', $limit=null )
    {
        $category = ReferentialCategory::fetchByIdentifier( $categoryIdentifier );

        if ( $category instanceof ReferentialCategory )
        {
            $db = MMDB::instance();
            $sql = "SELECT DISTINCT label FROM mm_referential_value WHERE cluster_identifier='".ClusterTool::clusterIdentifier()."' AND referential_category_id='".$category->attribute( 'id' )."' AND label LIKE '".$searchValue."%' ORDER BY label ".$sorts." LIMIT ".$limit;
            $query = $db->arrayQuery($sql);

            $result = array();
            foreach ( $query as $value )
            {
                $result[]=$value['label'];
            }          
            return $result;
        }
    }
{
    $script->shutdown(1, 'Import file doesn\'t exist or can\'t be read');
}

$handle = fopen($importFile, 'r');

if ($handle === FALSE)
{
    $script->shutdown(1, 'Unexpected error occured while trying to read import file');
}

$categoryIdentifier = 'city';
$clusterIdentifier = 'cluster_ru';

// Get category ID
$category = ReferentialCategory::fetchByIdentifier( $categoryIdentifier );
if ( ! ($category instanceof ReferentialCategory) )
{
    throw new \Exception('Unknown referential category "'.$categoryIdentifier.'"');
}
$categoryId = $category->attribute('id');

$db = MMDB::instance();
$db->begin();

if ($clear)
{
    // Clear existing values
    $query = 'DELETE FROM mm_referential_value WHERE cluster_identifier = "' . $clusterIdentifier . '" AND referential_category_id = ' . $categoryId;
    $db->query($query);
}