예제 #1
0
 /**
  * @inheritDoc
  */
 protected function prepareData(TableConfiguration $config)
 {
     $query = $this->glossaryKeyQuery->leftJoinSpyGlossaryTranslation()->groupByIdGlossaryKey();
     $lines = $this->runQuery($query, $config);
     $result = [];
     foreach ($lines as $value) {
         $details = $this->getDetails($value[SpyGlossaryKeyTableMap::COL_ID_GLOSSARY_KEY]);
         $result[] = array_merge($value, $details);
     }
     if (!empty($result)) {
         foreach ($result as $key => $value) {
             $result[$key][self::ACTIONS] = implode(' ', $this->buildActionUrls($value));
         }
     }
     return $result;
 }
예제 #2
0
 /**
  * @param \Orm\Zed\Glossary\Persistence\SpyGlossaryKeyQuery $keyQuery
  * @param array $relevantLocales
  *
  * @return \Propel\Runtime\ActiveQuery\ModelCriteria
  */
 protected function joinKeyQueryWithRelevantLocalesAndTranslations(SpyGlossaryKeyQuery $keyQuery, array $relevantLocales)
 {
     $keyLocaleCrossJoin = new ModelJoin();
     $keyLocaleCrossJoin->setJoinType(Criteria::JOIN);
     /*
      * @param string $value
      *
      * @return string
      */
     $quoteFunction = function ($value) {
         return "'{$value}'";
     };
     $quotedLocales = array_map($quoteFunction, $relevantLocales);
     $keyLocaleCrossJoin->setTableMap(new TableMap())->setLeftTableName('spy_glossary_key')->setRightTableName('spy_locale')->addCondition('id_glossary_key', 'id_locale', ModelCriteria::NOT_EQUAL);
     $translationLeftJoin = new ModelJoin();
     $translationLeftJoin->setJoinType(Criteria::LEFT_JOIN);
     $translationLeftJoin->setTableMap(new TableMap())->setLeftTableName('spy_glossary_key')->setRightTableName('spy_glossary_translation')->addCondition('id_glossary_key', 'fk_glossary_key');
     return $keyQuery->addJoinObject($keyLocaleCrossJoin, 'spy_locale')->addJoinObject($translationLeftJoin, 'spy_glossary_translation')->addJoinCondition('spy_glossary_translation', 'spy_locale.id_locale = spy_glossary_translation.fk_locale')->addJoinCondition('spy_locale', 'spy_locale.locale_name  IN (' . implode($quotedLocales, ', ') . ')');
 }
 /**
  * @return \Orm\Zed\Glossary\Persistence\SpyGlossaryKeyQuery
  */
 public function createGlossaryKeyQuery()
 {
     return SpyGlossaryKeyQuery::create();
 }