本文整理汇总了PHP中WishList::save方法的典型用法代码示例。如果您正苦于以下问题:PHP WishList::save方法的具体用法?PHP WishList::save怎么用?PHP WishList::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WishList
的用法示例。
在下文中一共展示了WishList::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeTomy
public function executeTomy(sfWebRequest $request)
{
$request->checkCSRFProtection();
$this->forward404Unless($location = Doctrine::getTable('Location')->find(array($request->getParameter('id'))), sprintf('Location does not exist (%s).', $request->getParameter('id')));
if (!$location->isOwner()) {
$whish = new WishList();
$whish->profile_id = $this->getUser()->getProfile()->getId();
$whish->location_id = $location->getId();
$whish->save();
}
}
示例2: createNewWishListForUser
public function createNewWishListForUser(User $user, $name = 'New Wish List', $type = WishList::TYPE_PRIVATE)
{
if (!$user || !$user->loaded()) {
throw new \InvalidArgumentException('User is not valid.');
}
$wishList = new WishList($this->pixie);
if (!$wishList->isValidType($type)) {
$type = WishList::TYPE_PRIVATE;
}
$wishList->type = $type;
$wishList->name = $name;
$wishList->created = date('Y-m-d H:i:s');
$wishList->addToUser($user);
$wishList->save();
return $wishList;
}