/**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(TranslationRequest $request)
 {
     $data = $request->all();
     $translationKeyword = new TranslationKeyword();
     $translationKeyword->setCatalogId($data['CatalogId']);
     $translationKeyword->setKeyword($data['Keyword']);
     $translationKeyword->save();
     foreach ($data['Languages'] as $language_id => $translation) {
         $translationLanguageKeyword = new TranslationLanguageKeyword();
         $translationLanguageKeyword->setLanguageId($language_id);
         $translationLanguageKeyword->setKeywordId($translationKeyword->getId());
         $translationLanguageKeyword->setTranslation($translation);
         $translationLanguageKeyword->save();
     }
     if ($translationKeyword->getTranslationCatalog()->getName() == 'general') {
         $this->rebuildTranslation();
     }
     flash()->success("ADDED");
     session(['attribute' => \Lang::get('general.TRANSLATION')]);
     return redirect($this->main_page);
 }
 /**
  * Filter the query by a related \App\Models\TranslationKeyword object
  *
  * @param \App\Models\TranslationKeyword|ObjectCollection $translationKeyword The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildTranslationLanguageKeywordQuery The current query, for fluid interface
  */
 public function filterByTranslationKeyword($translationKeyword, $comparison = null)
 {
     if ($translationKeyword instanceof \App\Models\TranslationKeyword) {
         return $this->addUsingAlias(TranslationLanguageKeywordTableMap::COL_KEYWORD_ID, $translationKeyword->getId(), $comparison);
     } elseif ($translationKeyword instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(TranslationLanguageKeywordTableMap::COL_KEYWORD_ID, $translationKeyword->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByTranslationKeyword() only accepts arguments of type \\App\\Models\\TranslationKeyword or Collection');
     }
 }
 /**
  * Exclude object from result
  *
  * @param   ChildTranslationKeyword $translationKeyword Object to remove from the list of results
  *
  * @return $this|ChildTranslationKeywordQuery The current query, for fluid interface
  */
 public function prune($translationKeyword = null)
 {
     if ($translationKeyword) {
         $this->addUsingAlias(TranslationKeywordTableMap::COL_ID, $translationKeyword->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 /**
  * Declares an association between this object and a ChildTranslationKeyword object.
  *
  * @param  ChildTranslationKeyword $v
  * @return $this|\App\Models\TranslationLanguageKeyword The current object (for fluent API support)
  * @throws PropelException
  */
 public function setTranslationKeyword(ChildTranslationKeyword $v = null)
 {
     if ($v === null) {
         $this->setKeywordId(NULL);
     } else {
         $this->setKeywordId($v->getId());
     }
     $this->aTranslationKeyword = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildTranslationKeyword object, it will not be re-added.
     if ($v !== null) {
         $v->addTranslationLanguageKeyword($this);
     }
     return $this;
 }