コード例 #1
0
 public function checkKeyword($id, $catalog_id, $keyword)
 {
     $translationKeyword = TranslationKeywordQuery::create()->findPK($id);
     if ($catalog_id != $translationKeyword->getCatalogId()) {
         return false;
     } elseif ($keyword != $translationKeyword->getKeyword()) {
         return false;
     }
     return true;
 }
コード例 #2
0
 /**
  * Create TranslationKeyword query.
  *
  */
 protected function createQuery($array, $search)
 {
     $this->translations = TranslationKeywordQuery::create();
     if (isset($array['CatalogId']) && $array['CatalogId'] !== "") {
         $this->translations->where("translation_keyword.catalog_id = " . $array['CatalogId']);
     }
     if (isset($array['Keyword']) && $array['Keyword'] !== "") {
         $this->translations->where("translation_keyword.keyword like '%" . $array['Keyword'] . "%'");
     }
     $language_name = $this->translationLanguage->getName();
     if (isset($array[$language_name]) && $array[$language_name] !== "") {
         $this->translations->useTranslationLanguageKeywordQuery()->where("translation_language_keyword.translation like '%" . $array[$language_name] . "%'")->endUse();
     }
     if ($search) {
         session(['translation_filter' => $array]);
     }
 }
コード例 #3
0
 /**
  * Returns the number of related TranslationKeyword objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      ConnectionInterface $con
  * @return int             Count of related TranslationKeyword objects.
  * @throws PropelException
  */
 public function countTranslationKeywords(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
 {
     $partial = $this->collTranslationKeywordsPartial && !$this->isNew();
     if (null === $this->collTranslationKeywords || null !== $criteria || $partial) {
         if ($this->isNew() && null === $this->collTranslationKeywords) {
             return 0;
         }
         if ($partial && !$criteria) {
             return count($this->getTranslationKeywords());
         }
         $query = ChildTranslationKeywordQuery::create(null, $criteria);
         if ($distinct) {
             $query->distinct();
         }
         return $query->filterByTranslationCatalog($this)->count($con);
     }
     return count($this->collTranslationKeywords);
 }
コード例 #4
0
 /**
  * Returns a new ChildTranslationKeywordQuery object.
  *
  * @param     string $modelAlias The alias of a model in the query
  * @param     Criteria $criteria Optional Criteria to build the query from
  *
  * @return ChildTranslationKeywordQuery
  */
 public static function create($modelAlias = null, Criteria $criteria = null)
 {
     if ($criteria instanceof ChildTranslationKeywordQuery) {
         return $criteria;
     }
     $query = new ChildTranslationKeywordQuery();
     if (null !== $modelAlias) {
         $query->setModelAlias($modelAlias);
     }
     if ($criteria instanceof Criteria) {
         $query->mergeWith($criteria);
     }
     return $query;
 }
コード例 #5
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $translationKeyword = TranslationKeywordQuery::create()->findPK($id);
     $translationKeyword->delete();
     if ($translationKeyword->getTranslationCatalog()->getName() == 'general') {
         $this->rebuildTranslation();
     }
     flash()->success("DELETED");
     session(['attribute' => \Lang::get('general.TRANSLATION')]);
     return redirect($this->main_page);
 }
コード例 #6
0
 /**
  * Builds a Criteria object containing the primary key for this object.
  *
  * Unlike buildCriteria() this method includes the primary key values regardless
  * of whether or not they have been modified.
  *
  * @throws LogicException if no primary key is defined
  *
  * @return Criteria The Criteria object containing value(s) for primary key(s).
  */
 public function buildPkeyCriteria()
 {
     $criteria = ChildTranslationKeywordQuery::create();
     $criteria->add(TranslationKeywordTableMap::COL_ID, $this->id);
     return $criteria;
 }
コード例 #7
0
 /**
  * Get the associated ChildTranslationKeyword object
  *
  * @param  ConnectionInterface $con Optional Connection object.
  * @return ChildTranslationKeyword The associated ChildTranslationKeyword object.
  * @throws PropelException
  */
 public function getTranslationKeyword(ConnectionInterface $con = null)
 {
     if ($this->aTranslationKeyword === null && $this->keyword_id !== null) {
         $this->aTranslationKeyword = ChildTranslationKeywordQuery::create()->findPk($this->keyword_id, $con);
         /* The following can be used additionally to
               guarantee the related object contains a reference
               to this object.  This level of coupling may, however, be
               undesirable since it could result in an only partially populated collection
               in the referenced object.
               $this->aTranslationKeyword->addTranslationLanguageKeywords($this);
            */
     }
     return $this->aTranslationKeyword;
 }
コード例 #8
0
 /**
  * Performs an INSERT on the database, given a TranslationKeyword or Criteria object.
  *
  * @param mixed               $criteria Criteria or TranslationKeyword object containing data that is used to create the INSERT statement.
  * @param ConnectionInterface $con the ConnectionInterface connection to use
  * @return mixed           The new primary key.
  * @throws PropelException Any exceptions caught during processing will be
  *                         rethrown wrapped into a PropelException.
  */
 public static function doInsert($criteria, ConnectionInterface $con = null)
 {
     if (null === $con) {
         $con = Propel::getServiceContainer()->getWriteConnection(TranslationKeywordTableMap::DATABASE_NAME);
     }
     if ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
         // rename for clarity
     } else {
         $criteria = $criteria->buildCriteria();
         // build Criteria from TranslationKeyword object
     }
     if ($criteria->containsKey(TranslationKeywordTableMap::COL_ID) && $criteria->keyContainsValue(TranslationKeywordTableMap::COL_ID)) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . TranslationKeywordTableMap::COL_ID . ')');
     }
     // Set the correct dbName
     $query = TranslationKeywordQuery::create()->mergeWith($criteria);
     // use transaction because $criteria could contain info
     // for more than one table (I guess, conceivably)
     return $con->transaction(function () use($con, $query) {
         return $query->doInsert($con);
     });
 }