library/Garp/I18n/ModelFactory.php
public function getBindingModel($bindingModel) {
        $this->_normalizeModel($bindingModel);
        $bindingModel = new $bindingModel();

        $referenceMap = $bindingModel->getReferenceMapNormalized();
        foreach ($referenceMap as $rule => $reference) {
            // Check here wether we need to internationalize the refTableClass
            $refModel = new $reference['refTableClass'];
            if ($refModel->getObserver('Translatable')) {
                try {
                    $refModel = $this->getModel($reference['refTableClass']);
                } catch (Garp_I18n_ModelFactory_Exception_ModelAlreadyLocalized $e) {
                    continue;
                }
            }
            $refTableClass = get_class($refModel);
            $bindingModel->addReference(
                $rule,
                $reference['columns'],
                $refTableClass,
                $reference['refColumns']
            );
        }
        return $bindingModel;
    }
public function getBindingModel($bindingModel) {
        $this->_normalizeModel($bindingModel);
        $bindingModel = new $bindingModel();

        $referenceMap = $bindingModel->getReferenceMapNormalized();
        foreach ($referenceMap as $rule => $reference) {
            // Check here wether we need to internationalize the refTableClass
            $refModel = new $reference['refTableClass'];
            if ($refModel->getObserver('Translatable')) {
                try {
                    $refModel = $this->getModel($reference['refTableClass']);
                } catch (Garp_I18n_ModelFactory_Exception_ModelAlreadyLocalized $e) {
                    continue;
                }
            }
            $refTableClass = get_class($refModel);
            $bindingModel->addReference(
                $rule,
                $reference['columns'],
                $refTableClass,
                $reference['refColumns']
            );
        }
        return $bindingModel;
    }
public function getBindingModel ( $ bindingModel ) { $ this -> _normalizeModel ( $ bindingModel ) ; $ bindingModel = new $ bindingModel ( ) ; $ referenceMap = $ bindingModel -> getReferenceMapNormalized ( ) ; foreach ( $ referenceMap as $ rule => $ reference ) { // Check here wether we need to internationalize the refTableClass $ refModel = new $ reference [ 'refTableClass' ] ; if ( $ refModel -> getObserver ( 'Translatable' ) ) { try { $ refModel = $ this -> getModel ( $ reference [ 'refTableClass' ] ) ; } catch ( Garp_I18n_ModelFactory_Exception_ModelAlreadyLocalized $ e ) { continue ; } } $ refTableClass = get_class ( $ refModel ) ; $ bindingModel -> addReference ( $ rule , $ reference [ 'columns' ] , $ refTableClass , $ reference [ 'refColumns' ] ) ; } return $ bindingModel ; }
Retrieve an internationalized bindingModel. Its referenceMap
will be tweaked to reflect the changes given as the second parameter.
@param Garp_Model_Db|String $model The original model, based on a table.
@return Garp_Model_Db
Retrieve an internationalized bindingModel . Its referenceMap will be tweaked to reflect the changes given as the second parameter .