Beispiel #1
0
 public function executeDeleteBikeEquipment()
 {
     $userId = sfContext::getInstance()->getUser()->getAttribute('subscriber_id', null, 'subscriber');
     $this->equip = $this->getRequestParameter('equip');
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         //delete user stat equip
         $c = new Criteria();
         $c->add(UserStatEquipPeer::USER_EQUIP_ID, $this->equip);
         $s = UserStatEquipPeer::doSelect($c);
         foreach ($s as $se) {
             $se->delete();
         }
         //delete equip
         $userEquip = UserEquipementPeer::retrieveByPK($this->equip);
         $userEquip->delete();
         return $this->redirect('userbike/index');
     }
 }
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(UserStatEquipPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(UserStatEquipPeer::DATABASE_NAME);
         $criteria->add(UserStatEquipPeer::USER_STAT_EQUIP_ID, $pks, Criteria::IN);
         $objs = UserStatEquipPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
 /**
  * Gets an array of UserStatEquip objects which contain a foreign key that references this object.
  *
  * If this collection has already been initialized with an identical Criteria, it returns the collection.
  * Otherwise if this UserEquipement has previously been saved, it will retrieve
  * related UserStatEquips from storage. If this UserEquipement is new, it will return
  * an empty collection or the current collection, the criteria is ignored on a new object.
  *
  * @param      PropelPDO $con
  * @param      Criteria $criteria
  * @return     array UserStatEquip[]
  * @throws     PropelException
  */
 public function getUserStatEquips($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(UserEquipementPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collUserStatEquips === null) {
         if ($this->isNew()) {
             $this->collUserStatEquips = array();
         } else {
             $criteria->add(UserStatEquipPeer::USER_EQUIP_ID, $this->equipment_id);
             UserStatEquipPeer::addSelectColumns($criteria);
             $this->collUserStatEquips = UserStatEquipPeer::doSelect($criteria, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // the following code is to determine if a new query is
             // called for.  If the criteria is the same as the last
             // one, just return the collection.
             $criteria->add(UserStatEquipPeer::USER_EQUIP_ID, $this->equipment_id);
             UserStatEquipPeer::addSelectColumns($criteria);
             if (!isset($this->lastUserStatEquipCriteria) || !$this->lastUserStatEquipCriteria->equals($criteria)) {
                 $this->collUserStatEquips = UserStatEquipPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastUserStatEquipCriteria = $criteria;
     return $this->collUserStatEquips;
 }
Beispiel #4
0
 public function executeDelete()
 {
     $userId = sfContext::getInstance()->getUser()->getAttribute('subscriber_id', null, 'subscriber');
     $this->statid = $this->getRequestParameter('statid');
     /*if($userId && $statid){
           $c = new Criteria();
           $c->add(UserStatsPeer::USER_ID,$userId);
           $c->add(UserStatsPeer::STAT_NO,$statid);
           $this->stat=UserStatsPeer::doSelect($c);
       }else{
          $this->stat=null;
       }*/
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         //need to delete user_stat_equipment
         $c = new Criteria();
         $c->add(UserStatEquipPeer::USER_STAT_ID, $this->statid);
         $statequip = UserStatEquipPeer::doSelect($c);
         foreach ($statequip as $se) {
             $se->delete();
         }
         //delete user_stat
         $c = new Criteria();
         $c->add(UserStatsPeer::USER_ID, $userId);
         $c->add(UserStatsPeer::STAT_NO, $this->statid);
         $s = UserStatsPeer::doSelect($c);
         foreach ($s as $stat) {
             $stat->delete();
         }
         return $this->redirect('userstats/index');
     }
 }