本文整理汇总了PHP中Menu::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Menu::getId方法的具体用法?PHP Menu::getId怎么用?PHP Menu::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::getId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addInstanceToPool
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Menu $value A Menu object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Menu $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}
示例2: setMenu
/**
* Declares an association between this object and a Menu object.
*
* @param Menu $v
* @return MenuItem The current object (for fluent API support)
* @throws PropelException
*/
public function setMenu(Menu $v = null)
{
if ($v === null) {
$this->setMenuId(NULL);
} else {
$this->setMenuId($v->getId());
}
$this->aMenu = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Menu object, it will not be re-added.
if ($v !== null) {
$v->addMenuItem($this);
}
return $this;
}
示例3: MenuItem
$menu_item->setUri('about');
$menu_item->save();
$menu_item = new MenuItem();
$menu_item->setWeight($weight++);
$menu_item->setMenuId($menu->getId());
$menu_item->setName('CONTACT');
$menu_item->setParentId($root_id);
$menu_item->setUri('contact');
$menu_item->save();
$menu = new Menu();
$menu->setName('页脚底部菜单');
$menu->setReserved(1);
$menu->save();
$menu_item = new MenuItem();
$menu_item->setWeight($weight++);
$menu_item->setMenuId($menu->getId());
$menu_item->setName('root');
$menu_item->setParentId(null);
$menu_item->setUri('');
$menu_item->save();
$root_id = $menu_item->getId();
$menu->setRootMenuItemId($root_id);
$menu->save();
$menu_item = new MenuItem();
$menu_item->setWeight($weight++);
$menu_item->setMenuId($menu->getId());
$menu_item->setName('HOME');
$menu_item->setParentId($root_id);
$menu_item->setUri('');
$menu_item->save();
$menu_item = new MenuItem();
示例4: testSetIdAndGetId
/**
* @corvers InakaPhper\Lunchlog\Entity\Menu::setId
* @corvers InakaPhper\Lunchlog\Entity\Menu::getId
*/
public function testSetIdAndGetId()
{
$this->entity->setId(20);
$this->assertEquals(20, $this->entity->getId());
}
示例5: Message
Message::register(new Message(Message::DANGER, i18n(array("en" => "name is required.", "zh" => "请填写name"))));
$error_flag = true;
}
// validation for country_id
$country_id = isset($_POST['country_id']) ? strip_tags($_POST['country_id']) : null;
/// proceed submission
// proceed for $name
$object->setName($name);
// proceed for $country_id
$object->setCountryId($country_id);
if ($error_flag == false) {
if ($object->save()) {
// create root menu_it
$menu_item = new MenuItem();
$menu_item->setWeight(0);
$menu_item->setMenuId($object->getId());
$menu_item->setName('root');
$menu_item->setParentId(null);
$menu_item->setUri('');
$menu_item->save();
$object->setRootMenuItemId($menu_item->getId());
$object->save();
Message::register(new Message(Message::SUCCESS, i18n(array("en" => "Record saved", "zh" => "记录保存成功"))));
HTML::forwardBackToReferer();
} else {
Message::register(new Message(Message::DANGER, i18n(array("en" => "Record failed to save", "zh" => "记录保存失败"))));
}
}
}
$html = new HTML();
$html->renderOut('core/backend/html_header', array('title' => i18n(array('en' => 'Create Menu', 'zh' => 'Create 菜单'))));
示例6: prune
/**
* Exclude object from result
*
* @param Menu $menu Object to remove from the list of results
*
* @return MenuQuery The current query, for fluid interface
*/
public function prune($menu = null)
{
if ($menu) {
$this->addUsingAlias(MenuPeer::ID, $menu->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
示例7: filterByMenu
/**
* Filter the query by a related Menu object
*
* @param Menu|PropelObjectCollection $menu The related object(s) to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return PerfilMenuQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
public function filterByMenu($menu, $comparison = null)
{
if ($menu instanceof Menu) {
return $this->addUsingAlias(PerfilMenuPeer::MENU_ID, $menu->getId(), $comparison);
} elseif ($menu instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this->addUsingAlias(PerfilMenuPeer::MENU_ID, $menu->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByMenu() only accepts arguments of type Menu or PropelCollection');
}
}