library/Garp/Model/ReferenceMapLocalizer.php
public function populate($relatedModel, $ruleKey = null) {
        // Sanity check: does the model have a reference to the
        // given model in the first place?
        // This will throw an exception if not.
        $relatedModel = $relatedModel instanceof Garp_Model_Db ? get_class($relatedModel) : $relatedModel;
        $relatedModel = (substr($relatedModel, 0, 6) !== 'Model_' ? 'Model_' : '') . $relatedModel;
        $ref = $this->_model->getReference($relatedModel, $ruleKey);
        $locales = Garp_I18n::getLocales();
        foreach ($locales as $locale) {
            $factory = new Garp_I18n_ModelFactory($locale);
            $localizedModel = $factory->getModel($relatedModel);
            $localizedModelName = get_class($localizedModel);
            $cleanLocalizedName = $localizedModel->getNameWithoutNamespace();
            $this->_model->addReference(
                $cleanLocalizedName,
                $ref[Zend_Db_Table_Abstract::COLUMNS],
                $localizedModelName,
                $ref[Zend_Db_Table_Abstract::REF_COLUMNS]
            );
        }
        return $this;
    }
public function populate($relatedModel, $ruleKey = null) {
        // Sanity check: does the model have a reference to the
        // given model in the first place?
        // This will throw an exception if not.
        $relatedModel = $relatedModel instanceof Garp_Model_Db ? get_class($relatedModel) : $relatedModel;
        $relatedModel = (substr($relatedModel, 0, 6) !== 'Model_' ? 'Model_' : '') . $relatedModel;
        $ref = $this->_model->getReference($relatedModel, $ruleKey);
        $locales = Garp_I18n::getLocales();
        foreach ($locales as $locale) {
            $factory = new Garp_I18n_ModelFactory($locale);
            $localizedModel = $factory->getModel($relatedModel);
            $localizedModelName = get_class($localizedModel);
            $cleanLocalizedName = $localizedModel->getNameWithoutNamespace();
            $this->_model->addReference(
                $cleanLocalizedName,
                $ref[Zend_Db_Table_Abstract::COLUMNS],
                $localizedModelName,
                $ref[Zend_Db_Table_Abstract::REF_COLUMNS]
            );
        }
        return $this;
    }
public function populate ( $ relatedModel , $ ruleKey = null ) { // Sanity check: does the model have a reference to the // given model in the first place? // This will throw an exception if not. $ relatedModel = $ relatedModel instanceof Garp_Model_Db ? get_class ( $ relatedModel ) : $ relatedModel ; $ relatedModel = ( substr ( $ relatedModel , 0 , 6 ) !== 'Model_' ? 'Model_' : '' ) . $ relatedModel ; $ ref = $ this -> _model -> getReference ( $ relatedModel , $ ruleKey ) ; $ locales = Garp_I18n :: getLocales ( ) ; foreach ( $ locales as $ locale ) { $ factory = new Garp_I18n_ModelFactory ( $ locale ) ; $ localizedModel = $ factory -> getModel ( $ relatedModel ) ; $ localizedModelName = get_class ( $ localizedModel ) ; $ cleanLocalizedName = $ localizedModel -> getNameWithoutNamespace ( ) ; $ this -> _model -> addReference ( $ cleanLocalizedName , $ ref [ Zend_Db_Table_Abstract :: COLUMNS ] , $ localizedModelName , $ ref [ Zend_Db_Table_Abstract :: REF_COLUMNS ] ) ; } return $ this ; }
Populate the subject model's referenceMap with
localized versions of the given model.
@param String|Garp_Model_Db $relatedModel
@return Void
Populate the subject model s referenceMap with localized versions of the given model .