public function configure() { unset($this['id'], $this['tribute_first_name'], $this['tribute_last_name'], $this['tribute_address1'], $this['tribute_address2'], $this['tribute_city'], $this['tribute_state'], $this['tribute_zipcode'], $this['tribute_email'], $this['tribute_category'], $this['tribute_message'], $this['tribute_deliver_by'], $this['tribute_gift_id'], $this['person_id'], $this['processedDate'], $this['novapointe_id'], $this['ccard_approval_number'], $this['novapointe_fulfillment_id'], $this['novapointe_tracking_number'], $this['novapointe_ship_date'], $this['tribute_letter_sent_date'], $this['send_tribute_card'], $this['tribute_image_id'], $this['ecard_read_date'], $this['ecardEmailSentDate'], $this['ecard_email_sent_result']); $donars = DonorPeer::getForSelectParent(); $campains = CampaignPeer::getForSelectParent(); $funds = FundPeer::getForSelectParent(); $gift_types = GiftTypePeer::getForSelectParent(); # Fields $this->widgetSchema['donor_id'] = new sfWidgetFormChoice(array('choices' => $donars)); $this->widgetSchema['gift_date'] = new widgetFormDate(array('change_year' => true, 'change_month' => true, 'format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text narrow')); $this->widgetSchema['gift_amount'] = new sfWidgetFormInput(array(), array('class' => 'text')); $this->widgetSchema['deductible_amount'] = new sfWidgetFormInput(array(), array('class' => 'text')); $this->widgetSchema['gift_type'] = new sfWidgetFormChoice(array('choices' => $gift_types)); $this->widgetSchema['check_number'] = new sfWidgetFormInput(array(), array('class' => 'text')); $this->widgetSchema['campain_id'] = new sfWidgetFormChoice(array('choices' => $campains)); $this->widgetSchema['fund_id'] = new sfWidgetFormChoice(array('choices' => $funds)); $this->widgetSchema['gift_note'] = new sfWidgetFormTextarea(array(), array('class' => 'text')); $this->widgetSchema['printed_note'] = new sfWidgetFormTextarea(array(), array('class' => 'text')); $this->widgetSchema['receipt_generated_date'] = new widgetFormDate(array('change_year' => true, 'change_month' => true, 'format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text narrow')); $this->widgetSchema['follow_up'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1)); $this->widgetSchema['premium_order_date'] = new widgetFormDate(array('change_year' => true, 'change_month' => true, 'format_date' => array('js' => 'mm/dd/yy', 'php' => 'm/d/Y')), array('class' => 'text narrow')); $this->widgetSchema->setLabels(array('donor_id' => 'Donor')); $this->widgetSchema->setLabels(array('gift_date' => 'Gift Date')); $this->widgetSchema->setLabels(array('gift_amount' => 'Gift Ammount')); $this->widgetSchema->setLabels(array('deductible_amount' => 'Deductible Amount')); $this->widgetSchema->setLabels(array('gift_type' => 'Gift Type')); $this->widgetSchema->setLabels(array('check_number' => 'Check Number')); $this->widgetSchema->setLabels(array('campain_id' => 'Campaign')); $this->widgetSchema->setLabels(array('fund_id' => 'Fund')); $this->widgetSchema->setLabels(array('gift_note' => 'Gift Note')); $this->widgetSchema->setLabels(array('printed_note' => 'Printed Note')); $this->widgetSchema->setLabels(array('receipt_generated_date' => 'Receipt Generated Date')); $this->widgetSchema->setLabels(array('follow_up' => 'Follow Up')); $this->widgetSchema->setLabels(array('premium_order_date' => 'Premium Order Date')); $this->validatorSchema['donor_id'] = new sfValidatorInteger(array('required' => true)); $this->validatorSchema['gift_date'] = new sfValidatorDate(array('max' => time(), 'required' => false)); $this->validatorSchema['gift_amount'] = new sfValidatorInteger(array('required' => false), array('invalid' => 'Gift ammount must ne in number format !')); $this->validatorSchema['deductible_amount'] = new sfValidatorInteger(array('required' => false)); $this->validatorSchema['gift_type'] = new sfValidatorInteger(array('required' => true)); $this->validatorSchema['check_number'] = new sfValidatorString(array('required' => false)); $this->validatorSchema['campain_id'] = new sfValidatorInteger(array('required' => true)); $this->validatorSchema['fund_id'] = new sfValidatorInteger(array('required' => true)); $this->validatorSchema['gift_note'] = new sfValidatorString(array('required' => false)); $this->validatorSchema['printed_note'] = new sfValidatorString(array('required' => false)); $this->validatorSchema['receipt_generated_date'] = new sfValidatorDate(array('max' => time(), 'required' => false), array('invalid' => 'Receipt Generated Date in invalid !.')); $this->validatorSchema['follow_up'] = new sfValidatorInteger(array('required' => false)); $this->validatorSchema['premium_order_date'] = new sfValidatorDate(array('max' => time(), 'required' => false), array('invalid' => 'Premium Order Date in invalid !.')); $this->widgetSchema->setNameFormat('dona[%s]'); }
/** * TODO: Check related records. * CODE:campaign_delete */ public function executeDelete(sfWebRequest $request) { # security if (!$this->getUser()->hasCredential(array('Administrator'), false)) { $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer()); $this->redirect('dashboard/index'); } $this->getUser()->setFlash('success', '...'); $this->redirect('campaign'); if ($request->isMethod('post')) { $campaign = CampaignPeer::retrieveByPK($request->getParameter('id')); $this->forward404Unless($campaign); $this->getUser()->setFlash('success', 'Campaign information has been successfully deleted!'); $campaign->delete(); } return $this->redirect('@campaign'); }
/** * Get the associated Campaign object * * @param PropelPDO Optional Connection object. * @return Campaign The associated Campaign object. * @throws PropelException */ public function getCampaign(PropelPDO $con = null) { if ($this->aCampaign === null && $this->campain_id !== null) { $c = new Criteria(CampaignPeer::DATABASE_NAME); $c->add(CampaignPeer::ID, $this->campain_id); $this->aCampaign = CampaignPeer::doSelectOne($c, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aCampaign->addDonations($this); */ } return $this->aCampaign; }
/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * The default key type is the column's phpname (e.g. 'AuthorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = CampaignPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setCampaignDecs($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setPremiumSku($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setPremiumMin($arr[$keys[3]]); } }
/** * 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(CampaignPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(CampaignPeer::DATABASE_NAME); $criteria->add(CampaignPeer::ID, $pks, Criteria::IN); $objs = CampaignPeer::doSelect($criteria, $con); } return $objs; }
/** * Selects a collection of Donation objects pre-filled with all related objects except Fund. * * @param Criteria $c * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of Donation objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptFund(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $c = clone $c; // Set the correct dbName if it has not been overridden // $c->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } DonationPeer::addSelectColumns($c); $startcol2 = DonationPeer::NUM_COLUMNS - DonationPeer::NUM_LAZY_LOAD_COLUMNS; DonorPeer::addSelectColumns($c); $startcol3 = $startcol2 + (DonorPeer::NUM_COLUMNS - DonorPeer::NUM_LAZY_LOAD_COLUMNS); GiftTypePeer::addSelectColumns($c); $startcol4 = $startcol3 + (GiftTypePeer::NUM_COLUMNS - GiftTypePeer::NUM_LAZY_LOAD_COLUMNS); CampaignPeer::addSelectColumns($c); $startcol5 = $startcol4 + (CampaignPeer::NUM_COLUMNS - CampaignPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(DonationPeer::DONOR_ID), array(DonorPeer::ID), $join_behavior); $c->addJoin(array(DonationPeer::GIFT_TYPE), array(GiftTypePeer::ID), $join_behavior); $c->addJoin(array(DonationPeer::CAMPAIN_ID), array(CampaignPeer::ID), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = DonationPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = DonationPeer::getInstanceFromPool($key1))) { // We no longer rehydrate the object, since this can cause data loss. // See http://propel.phpdb.org/trac/ticket/509 // $obj1->hydrate($row, 0, true); // rehydrate } else { $omClass = DonationPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); DonationPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Donor rows $key2 = DonorPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = DonorPeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = DonorPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); DonorPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (Donation) to the collection in $obj2 (Donor) $obj2->addDonation($obj1); } // if joined row is not null // Add objects for joined GiftType rows $key3 = GiftTypePeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = GiftTypePeer::getInstanceFromPool($key3); if (!$obj3) { $omClass = GiftTypePeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); GiftTypePeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (Donation) to the collection in $obj3 (GiftType) $obj3->addDonation($obj1); } // if joined row is not null // Add objects for joined Campaign rows $key4 = CampaignPeer::getPrimaryKeyHashFromRow($row, $startcol4); if ($key4 !== null) { $obj4 = CampaignPeer::getInstanceFromPool($key4); if (!$obj4) { $omClass = CampaignPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj4 = new $cls(); $obj4->hydrate($row, $startcol4); CampaignPeer::addInstanceToPool($obj4, $key4); } // if $obj4 already loaded // Add the $obj1 (Donation) to the collection in $obj4 (Campaign) $obj4->addDonation($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }