/** * 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 to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildTranslationCatalogQuery The current query, for fluid interface */ public function filterByTranslationKeyword($translationKeyword, $comparison = null) { if ($translationKeyword instanceof \App\Models\TranslationKeyword) { return $this->addUsingAlias(TranslationCatalogTableMap::COL_ID, $translationKeyword->getCatalogId(), $comparison); } elseif ($translationKeyword instanceof ObjectCollection) { return $this->useTranslationKeywordQuery()->filterByPrimaryKeys($translationKeyword->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByTranslationKeyword() only accepts arguments of type \\App\\Models\\TranslationKeyword or Collection'); } }
/** * 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'); } }
/** * @param ChildTranslationKeyword $translationKeyword The ChildTranslationKeyword object to add. */ protected function doAddTranslationKeyword(ChildTranslationKeyword $translationKeyword) { $this->collTranslationKeywords[] = $translationKeyword; $translationKeyword->setTranslationCatalog($this); }
/** * 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; }
/** * Clears the current object, sets all attributes to their default values and removes * outgoing references as well as back-references (from other objects to this one. Results probably in a database * change of those foreign objects when you call `save` there). */ public function clear() { if (null !== $this->aTranslationLanguage) { $this->aTranslationLanguage->removeTranslationLanguageKeyword($this); } if (null !== $this->aTranslationKeyword) { $this->aTranslationKeyword->removeTranslationLanguageKeyword($this); } $this->language_id = null; $this->keyword_id = null; $this->translation = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; $this->clearAllReferences(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); }