src/Extension/FluentExtension.php
protected function localiseSelect($table, $field, Locale $locale)
    {
        // Build case for each locale down the chain
        $query = "CASE\n";
        foreach ($locale->getChain() as $joinLocale) {
            $joinAlias = $this->getLocalisedTable($table, $joinLocale->Locale);
            $query .= "\tWHEN \"{$joinAlias}\".\"ID\" IS NOT NULL THEN \"{$joinAlias}\".\"{$field}\"\n";
        }

        // Note: In CMS only we fall back to value in root table (in case not yet migrated)
        // On the frontend this row would have been filtered already (see augmentSQL logic)
        $sqlDefault = "\"{$table}\".\"{$field}\"";
        $this->owner->invokeWithExtensions('updateLocaliseSelectDefault', $sqlDefault, $table, $field, $locale);
        $query .= "\tELSE $sqlDefault END\n";

        // Fall back to null by default, but allow extensions to override this entire fragment
        // Note: Extensions are responsible for SQL escaping
        $this->owner->invokeWithExtensions('updateLocaliseSelect', $query, $table, $field, $locale);
        return $query;
    }
protected function localiseSelect($table, $field, Locale $locale)
    {
        // Build case for each locale down the chain
        $query = "CASE\n";
        foreach ($locale->getChain() as $joinLocale) {
            $joinAlias = $this->getLocalisedTable($table, $joinLocale->Locale);
            $query .= "\tWHEN \"{$joinAlias}\".\"ID\" IS NOT NULL THEN \"{$joinAlias}\".\"{$field}\"\n";
        }

        // Note: In CMS only we fall back to value in root table (in case not yet migrated)
        // On the frontend this row would have been filtered already (see augmentSQL logic)
        $sqlDefault = "\"{$table}\".\"{$field}\"";
        $this->owner->invokeWithExtensions('updateLocaliseSelectDefault', $sqlDefault, $table, $field, $locale);
        $query .= "\tELSE $sqlDefault END\n";

        // Fall back to null by default, but allow extensions to override this entire fragment
        // Note: Extensions are responsible for SQL escaping
        $this->owner->invokeWithExtensions('updateLocaliseSelect', $query, $table, $field, $locale);
        return $query;
    }
protected function localiseSelect ( $ table , $ field , Locale $ locale ) { // Build case for each locale down the chain $ query = "CASE\n" ; foreach ( $ locale -> getChain ( ) as $ joinLocale ) { $ joinAlias = $ this -> getLocalisedTable ( $ table , $ joinLocale -> Locale ) ; $ query .= "\tWHEN \"{$joinAlias}\".\"ID\" IS NOT NULL THEN \"{$joinAlias}\".\"{$field}\"\n" ; } // Note: In CMS only we fall back to value in root table (in case not yet migrated) // On the frontend this row would have been filtered already (see augmentSQL logic) $ sqlDefault = "\"{$table}\".\"{$field}\"" ; $ this -> owner -> invokeWithExtensions ( 'updateLocaliseSelectDefault' , $ sqlDefault , $ table , $ field , $ locale ) ; $ query .= "\tELSE $sqlDefault END\n" ; // Fall back to null by default, but allow extensions to override this entire fragment // Note: Extensions are responsible for SQL escaping $ this -> owner -> invokeWithExtensions ( 'updateLocaliseSelect' , $ query , $ table , $ field , $ locale ) ; return $ query ; }
Generates a select fragment based on a field with a fallback

@param string $table
@param string $field
@param Locale $locale
@return string Select fragment
Generates a select fragment based on a field with a fallback