library/Garp/Model/Behavior/Translatable.php
public function mergeTranslatedFields($result) {
        if (!isset($result->{self::I18N_MODEL_BINDING_ALIAS})) {
            return;
        }
        $translationRecordList = $result->{self::I18N_MODEL_BINDING_ALIAS};
        if ($translationRecordList instanceof Zend_Db_Table_Rowset_Abstract) {
            $translationRecordList = $translationRecordList->toArray();
        }
        $translatedFields = array();
        $allLocales = Garp_I18n::getLocales();
        foreach ($this->_translatableFields as $translatableField) {
            // provide default values
            foreach ($allLocales as $locale) {
                $translatedFields[$translatableField][$locale] = null;
            }
            foreach ($translationRecordList as $translationRecord) {
                $lang = $translationRecord[self::LANG_COLUMN];
                $translatedFields[$translatableField][$lang]
                    = $translationRecord[$translatableField];
            }
            $result->setVirtual($translatableField, $translatedFields[$translatableField]);
                //$lang] = $translationRecord[$translatableField];
        }
        // We now have a $translatedFields array like this:
        // array(
        //   "name" => array(
        //     "nl" => "Schaap",
        //     "en" => "Sheep"
        //   )
        // )
        //$result->setFromArray($translatedFields);
        unset($result->{self::I18N_MODEL_BINDING_ALIAS});
    }
public function mergeTranslatedFields($result) {
        if (!isset($result->{self::I18N_MODEL_BINDING_ALIAS})) {
            return;
        }
        $translationRecordList = $result->{self::I18N_MODEL_BINDING_ALIAS};
        if ($translationRecordList instanceof Zend_Db_Table_Rowset_Abstract) {
            $translationRecordList = $translationRecordList->toArray();
        }
        $translatedFields = array();
        $allLocales = Garp_I18n::getLocales();
        foreach ($this->_translatableFields as $translatableField) {
            // provide default values
            foreach ($allLocales as $locale) {
                $translatedFields[$translatableField][$locale] = null;
            }
            foreach ($translationRecordList as $translationRecord) {
                $lang = $translationRecord[self::LANG_COLUMN];
                $translatedFields[$translatableField][$lang]
                    = $translationRecord[$translatableField];
            }
            $result->setVirtual($translatableField, $translatedFields[$translatableField]);
                //$lang] = $translationRecord[$translatableField];
        }
        // We now have a $translatedFields array like this:
        // array(
        //   "name" => array(
        //     "nl" => "Schaap",
        //     "en" => "Sheep"
        //   )
        // )
        //$result->setFromArray($translatedFields);
        unset($result->{self::I18N_MODEL_BINDING_ALIAS});
    }
public function mergeTranslatedFields ( $ result ) { if ( ! isset ( $ result -> { self :: I18N_MODEL_BINDING_ALIAS } ) ) { return ; } $ translationRecordList = $ result -> { self :: I18N_MODEL_BINDING_ALIAS } ; if ( $ translationRecordList instanceof Zend_Db_Table_Rowset_Abstract ) { $ translationRecordList = $ translationRecordList -> toArray ( ) ; } $ translatedFields = array ( ) ; $ allLocales = Garp_I18n :: getLocales ( ) ; foreach ( $ this -> _translatableFields as $ translatableField ) { // provide default values foreach ( $ allLocales as $ locale ) { $ translatedFields [ $ translatableField ] [ $ locale ] = null ; } foreach ( $ translationRecordList as $ translationRecord ) { $ lang = $ translationRecord [ self :: LANG_COLUMN ] ; $ translatedFields [ $ translatableField ] [ $ lang ] = $ translationRecord [ $ translatableField ] ; } $ result -> setVirtual ( $ translatableField , $ translatedFields [ $ translatableField ] ) ; //$lang] = $translationRecord[$translatableField]; } // We now have a $translatedFields array like this: // array( //   "name" => array( //     "nl" => "Schaap", //     "en" => "Sheep" //   ) // ) //$result->setFromArray($translatedFields); unset ( $ result -> { self :: I18N_MODEL_BINDING_ALIAS } ) ; }
Merge translated fields into the main records

@param Garp_Db_Table_Row $result
@return void
Merge translated fields into the main records