public function addMenu(MenuEvent $event) { $menu = new Menu(); $menu->save(); $menu_i18n = new MenuI18n(); $menu_i18n->setId($menu->getId()); $menu_i18n->setTitle($event->getTitle()); $menu_i18n->setDescription($event->getDescription()); $menu_i18n->setLocale('fr_FR'); $menu_i18n->save(); $event->setId($menu->getId()); }
/** * Declares an association between this object and a ChildMenuI18n object. * * @param ChildMenuI18n $v * @return \Menu\Model\MenuI18nVersion The current object (for fluent API support) * @throws PropelException */ public function setMenuI18n(ChildMenuI18n $v = null) { if ($v === null) { $this->setId(NULL); } else { $this->setId($v->getId()); } $this->aMenuI18n = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the ChildMenuI18n object, it will not be re-added. if ($v !== null) { $v->addMenuI18nVersion($this); } return $this; }
/** * Filter the query by a related \Menu\Model\MenuI18n object * * @param \Menu\Model\MenuI18n|ObjectCollection $menuI18n The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildMenuI18nVersionQuery The current query, for fluid interface */ public function filterByMenuI18n($menuI18n, $comparison = null) { if ($menuI18n instanceof \Menu\Model\MenuI18n) { return $this->addUsingAlias(MenuI18nVersionTableMap::ID, $menuI18n->getId(), $comparison); } elseif ($menuI18n instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(MenuI18nVersionTableMap::ID, $menuI18n->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByMenuI18n() only accepts arguments of type \\Menu\\Model\\MenuI18n or Collection'); } }
/** * Exclude object from result * * @param ChildMenuI18n $menuI18n Object to remove from the list of results * * @return ChildMenuI18nQuery The current query, for fluid interface */ public function prune($menuI18n = null) { if ($menuI18n) { $this->addUsingAlias(MenuI18nTableMap::ID, $menuI18n->getId(), Criteria::NOT_EQUAL); } return $this; }