예제 #1
0
 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
0
 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;
 }