src/Attribute/TranslatedSelect.php
public function valueToWidget($varValue)
    {
        $strColNameWhere = $this->getAdditionalWhere();
        $strColNameAlias = $this->getAliasColumn();
        if (!$strColNameAlias) {
            $strColNameAlias = $this->getIdColumn();
        }

        // Easy out, we have the correct language.
        if ($varValue[$this->getLanguageColumn()] == $this->getMetaModel()->getActiveLanguage()) {
            return $varValue[$strColNameAlias];
        }

        // Translate to current language.
        $builder = $this->connection->createQueryBuilder()
            ->select('s.*')
            ->from($this->getSelectSource(), 's')
            ->where($this->getIdColumn() . '=:id')
            ->andWhere($this->getLanguageColumn() . '=:language')
            ->setParameter('id', $varValue[$this->getIdColumn()])
            ->setParameter('language', $this->getMetaModel()->getActiveLanguage());

        if ($strColNameWhere) {
            $builder->andWhere($strColNameWhere);
        }

        $statement = $builder->execute();
        $result    = $statement->fetch(\PDO::FETCH_OBJ);

        return $result->$strColNameAlias;
    }
public function valueToWidget($varValue)
    {
        $strColNameWhere = $this->getAdditionalWhere();
        $strColNameAlias = $this->getAliasColumn();
        if (!$strColNameAlias) {
            $strColNameAlias = $this->getIdColumn();
        }

        // Easy out, we have the correct language.
        if ($varValue[$this->getLanguageColumn()] == $this->getMetaModel()->getActiveLanguage()) {
            return $varValue[$strColNameAlias];
        }

        // Translate to current language.
        $builder = $this->connection->createQueryBuilder()
            ->select('s.*')
            ->from($this->getSelectSource(), 's')
            ->where($this->getIdColumn() . '=:id')
            ->andWhere($this->getLanguageColumn() . '=:language')
            ->setParameter('id', $varValue[$this->getIdColumn()])
            ->setParameter('language', $this->getMetaModel()->getActiveLanguage());

        if ($strColNameWhere) {
            $builder->andWhere($strColNameWhere);
        }

        $statement = $builder->execute();
        $result    = $statement->fetch(\PDO::FETCH_OBJ);

        return $result->$strColNameAlias;
    }
public function valueToWidget ( $ varValue ) { $ strColNameWhere = $ this -> getAdditionalWhere ( ) ; $ strColNameAlias = $ this -> getAliasColumn ( ) ; if ( ! $ strColNameAlias ) { $ strColNameAlias = $ this -> getIdColumn ( ) ; } // Easy out, we have the correct language. if ( $ varValue [ $ this -> getLanguageColumn ( ) ] == $ this -> getMetaModel ( ) -> getActiveLanguage ( ) ) { return $ varValue [ $ strColNameAlias ] ; } // Translate to current language. $ builder = $ this -> connection -> createQueryBuilder ( ) -> select ( 's.*' ) -> from ( $ this -> getSelectSource ( ) , 's' ) -> where ( $ this -> getIdColumn ( ) . '=:id' ) -> andWhere ( $ this -> getLanguageColumn ( ) . '=:language' ) -> setParameter ( 'id' , $ varValue [ $ this -> getIdColumn ( ) ] ) -> setParameter ( 'language' , $ this -> getMetaModel ( ) -> getActiveLanguage ( ) ) ; if ( $ strColNameWhere ) { $ builder -> andWhere ( $ strColNameWhere ) ; } $ statement = $ builder -> execute ( ) ; $ result = $ statement -> fetch ( \ PDO :: FETCH_OBJ ) ; return $ result -> $ strColNameAlias ; }
{@inheritdoc}
{