コード例 #1
0
 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());
 }
コード例 #2
0
 /**
  * Filter the query by a related \Menu\Model\Menu object
  *
  * @param \Menu\Model\Menu|ObjectCollection $menu The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildMenuVersionQuery The current query, for fluid interface
  */
 public function filterByMenu($menu, $comparison = null)
 {
     if ($menu instanceof \Menu\Model\Menu) {
         return $this->addUsingAlias(MenuVersionTableMap::ID, $menu->getId(), $comparison);
     } elseif ($menu instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(MenuVersionTableMap::ID, $menu->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByMenu() only accepts arguments of type \\Menu\\Model\\Menu or Collection');
     }
 }
コード例 #3
0
 /**
  * Sets the properties of the current object to the value they had at a specific version
  *
  * @param ChildMenuItemVersion $version The version object to use
  * @param ConnectionInterface   $con the connection to use
  * @param array                 $loadedObjects objects that been loaded in a chain of populateFromVersion calls on referrer or fk objects.
  *
  * @return ChildMenuItem The current object (for fluent API support)
  */
 public function populateFromVersion($version, $con = null, &$loadedObjects = array())
 {
     $loadedObjects['ChildMenuItem'][$version->getId()][$version->getVersion()] = $this;
     $this->setId($version->getId());
     $this->setMenuId($version->getMenuId());
     $this->setVisible($version->getVisible());
     $this->setPosition($version->getPosition());
     $this->setTypobj($version->getTypobj());
     $this->setObjet($version->getObjet());
     $this->setCreatedAt($version->getCreatedAt());
     $this->setUpdatedAt($version->getUpdatedAt());
     $this->setVersion($version->getVersion());
     $this->setVersionCreatedAt($version->getVersionCreatedAt());
     $this->setVersionCreatedBy($version->getVersionCreatedBy());
     if ($fkValue = $version->getMenuId()) {
         if (isset($loadedObjects['ChildMenu']) && isset($loadedObjects['ChildMenu'][$fkValue]) && isset($loadedObjects['ChildMenu'][$fkValue][$version->getMenuIdVersion()])) {
             $related = $loadedObjects['ChildMenu'][$fkValue][$version->getMenuIdVersion()];
         } else {
             $related = new ChildMenu();
             $relatedVersion = ChildMenuVersionQuery::create()->filterById($fkValue)->filterByVersion($version->getMenuIdVersion())->findOne($con);
             $related->populateFromVersion($relatedVersion, $con, $loadedObjects);
             $related->setNew(false);
         }
         $this->setMenu($related);
     }
     return $this;
 }
コード例 #4
0
 /**
  * Declares an association between this object and a ChildMenu object.
  *
  * @param                  ChildMenu $v
  * @return                 \Menu\Model\MenuVersion The current object (for fluent API support)
  * @throws PropelException
  */
 public function setMenu(ChildMenu $v = null)
 {
     if ($v === null) {
         $this->setId(NULL);
     } else {
         $this->setId($v->getId());
     }
     $this->aMenu = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildMenu object, it will not be re-added.
     if ($v !== null) {
         $v->addMenuVersion($this);
     }
     return $this;
 }
コード例 #5
0
 /**
  * Exclude object from result
  *
  * @param   ChildMenu $menu Object to remove from the list of results
  *
  * @return ChildMenuQuery The current query, for fluid interface
  */
 public function prune($menu = null)
 {
     if ($menu) {
         $this->addUsingAlias(MenuTableMap::ID, $menu->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }