/** * @param $data * @param Member $member * @param Org $org * @return Affiliation */ public function build($data, Member $member, Org $org) { $affiliation = Affiliation::create(); $affiliation->OrganizationID = $org->ID; $affiliation->MemberID = $member->ID; $affiliation->StartDate = $data->StartDate; $affiliation->EndDate = !empty($data->EndDate) ? $data->EndDate : null; $affiliation->Current = $data->Current == 1 ? true : false; if (empty($affiliation->EndDate)) { $affiliation->Current = true; } return $affiliation; }
public static function createFromResponse(\SimpleXMLElement $response) { $affiliation = new Affiliation(); $affiliation->setSupplierName((string) $response->supplierName); $price = array(); $price['currency'] = (string) $response->price->currency; $price['amount'] = (double) $response->price->amount; $affiliation->setPrice($price); $affiliation->setBuyLink((string) $response->buyLink); $affiliation->setSupplierIcon((string) $response->supplierIcon); $affiliation->setIsSearch((int) $response->isSearch); return $affiliation; }
public function DeleteAffiliation($request) { if ($CurrentMember = Member::currentUser()) { $params = $request->allParams(); $affilliation_id = $params["ID"]; $affilliation_id = Convert::raw2sql($affilliation_id); $affiliationDB = Affiliation::get()->byID($affilliation_id); if ($affiliationDB) { $affiliationDB->delete(); } echo json_encode('OK'); exit; } echo json_encode('ERROR'); }
/** * @param ISummit $summit * @param array $attendee_data * @return mixed */ public function updateAttendee(ISummit $summit, array $attendee_data) { $attendee_repository = $this->attendee_repository; return $this->tx_service->transaction(function () use($summit, $attendee_data, $attendee_repository) { if (!isset($attendee_data['id'])) { throw new EntityValidationException('missing required param: id'); } $member_id = $attendee_data['member']; $attendee_id = intval($attendee_data['id']); $attendee = $attendee_repository->getByMemberAndSummit($member_id, $summit->getIdentifier()); if ($attendee && $attendee->ID != $attendee_id) { throw new EntityValidationException('This member is already assigned to another tix'); } $attendee = $attendee_repository->getById($attendee_id); if (is_null($attendee)) { throw new NotFoundEntityException('Summit Attendee', sprintf('id %s', $attendee_id)); } if (intval($attendee->SummitID) !== intval($summit->getIdentifier())) { throw new EntityValidationException('attendee doest not belong to summit'); } $attendee->MemberID = $member_id; $attendee->SharedContactInfo = $attendee_data['share_info']; if ($attendee_data['checked_in']) { $attendee->registerSummitHallChecking(); } else { $attendee->SummitHallCheckedIn = $attendee_data['checked_in']; } if ($attendee->Member() && $attendee->Member()->Speaker()->ID) { $attendee->Member()->Speaker()->Title = $attendee_data['title']; $attendee->Member()->Speaker()->FirstName = $attendee_data['first_name']; $attendee->Member()->Speaker()->LastName = $attendee_data['last_name']; $attendee->Member()->Speaker()->Bio = $attendee_data['bio']; $attendee->Member()->Speaker()->write(); } if ($attendee->Member()) { $current_affiliation = $attendee->Member()->getcurrentAffiliation(); if (!$current_affiliation) { $current_affiliation = new Affiliation(); } $current_affiliation->OrganizationID = $attendee_data['aff_company']; $current_affiliation->StartDate = $attendee_data['aff_from']; $current_affiliation->EndDate = $attendee_data['aff_to']; $current_affiliation->Current = $attendee_data['aff_current']; $current_affiliation->write(); $attendee->Member()->Affiliations()->add($current_affiliation); } return $attendee; }); }
/** * Declares an association between this object and a Affiliation object. * * @param Affiliation $v * @return Donor The current object (for fluent API support) * @throws PropelException */ public function setAffiliation(Affiliation $v = null) { if ($v === null) { $this->setAffiliationId(NULL); } else { $this->setAffiliationId($v->getId()); } $this->aAffiliation = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Affiliation object, it will not be re-added. if ($v !== null) { $v->addDonor($this); } return $this; }
/** * 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 Affiliation $value A Affiliation object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(Affiliation $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }