public static function reap($set, $try_to_do_multi = true) { $items = array(); if (is_array($set)) { if (count($set) >= sfConfig::get('app_reap_single_clients_min')) { $items = self::prepareReap($set); } } // test if we should do a multiple client reap if ($try_to_do_multi) { // the "3" value is a way to short circuit this $do_multi = $try_to_do_multi == 3 || time() % sfConfig::get('app_reap_multi_time_mod') == 0; } if ($do_multi) { $criteria = new Criteria(); $criteria->setLimit(sfConfig::get('app_reap_multi_clients_max')); $criteria->addAscendingOrderByColumn(ClientPeer::UPDATED_AT); $criteria->add(ClientPeer::UPDATED_AT, time() - sfConfig::get('app_reap_client_age_max'), Criteria::LESS_EQUAL); // fixme this should be refined more -- perhaps seeds should be even less likely to be reaped etc? $all = ClientPeer::doSelect($criteria); $items = array_merge(self::prepareReap($all), $items); } if (count($items) > sfConfig::get('app_reap_single_kills_min') || $do_multi) { if (count($items)) { self::doDelete($items); // does do delete actually call the delete method on each? } } // todo: deleted items should be removed from set return $set; }
public function executeShowClient(sfWebRequest $request) { $this->client = ClientPeer::retrieveByPK($request->getParameter('id')); $c = new Criteria(); $c->addAscendingOrderByColumn(NoteEntryPeer::SERVICE_DATE); // only show entries for current month $c->add(NoteEntryPeer::SERVICE_DATE, mktime(0, 0, 0, date('n'), 1, date('Y')), Criteria::GREATER_EQUAL); $c->addAnd(NoteEntryPeer::SERVICE_DATE, strtotime('+1 MONTH -1 SECOND', mktime(0, 0, 0, date('n'), 1, date('Y'))), Criteria::LESS_EQUAL); $this->entries = $this->client->getNoteEntrys($c); }
public function getClients() { $c = new Criteria(); $c->add(JobClientPeer::JOB_ID, $this->getId()); $clientIds = array(); $jc = JobClientPeer::doSelect($c); foreach ($jc as $i) { $clientIds[] = $i->getClientId(); } $c = new Criteria(); $c->add(ClientPeer::ID, $clientIds, Criteria::IN); return ClientPeer::doSelect($c); }
public static function getArrayForAutocomplete($q) { $c = new Criteria(); $crit0 = $c->getNewCriterion(ClientPeer::NAME, "%" . $q . "%", Criteria::LIKE); $crit1 = $c->getNewCriterion(ClientPeer::EMAIL, "%" . $q . "%", Criteria::LIKE); $crit0->addOr($crit1); $c->add($crit0); $c->setLimit(10); $names = array(); $clients = ClientPeer::doSelect($c); foreach ($clients as $p) { $names[] = array("id" => $p->getId(), "name" => $p->getName(), "email" => $p->getEmail()); } return $names; }
public function executeEdit(sfWebRequest $request) { $client = ClientPeer::retrieveByPK($request->getParameter("client_id")); $updating = $request->getParameter("form"); switch ($updating) { case "info": $form = new InfoClientForm($client); $this->bindAndValidateForm($form, $request); $this->renderPartial("Info", array("client" => $client, "InfoForm" => $form)); break; default: break; } return sfView::NONE; }
public static function isOwner($jobId, $userId) { $c = new Criteria(); $c->add(ClientPeer::USER_ID, $userId); $client = ClientPeer::doSelectOne($c); if (is_null($client)) { return false; } $cid = $client->getId(); if (!array_key_exists($cid, self::$clientJobIdCache)) { self::$clientJobIdCache[$cid] = array(); self::$clientJobIdCache[$cid] = self::getJobsByClientId($cid); } return in_array($jobId, self::$clientJobIdCache[$cid]); }
public function save($con = null) { sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url', 'Object', 'Tag', 'Text', 'PMRender', 'Asset', 'Helper')); $j = new Job(); $j->setEvent($this->getValue("event")); $j->setStartTime($this->getValue("start_time")); $j->setEndTime($this->getValue("end_time")); $j->setDate($this->getValue("date")); $j->setDueDate($this->getValue("due_date")); $j->setAcctNum($this->getValue("acct_num")); $j->setDeptId($this->getValue("dept_id")); $j->setPublicationId($this->getValue("publication_id")); $j->setStreet($this->getValue("street")); $j->setCity($this->getValue("city")); $j->setState($this->getValue("state")); $j->setZip($this->getValue("zip")); if (is_array($this->getValue("photo_type"))) { $j->setPhotoType(implode(", ", $this->getValue("photo_type"))); } else { $j->setPhotoType($this->getValue("photo_type")); } $j->setOther($this->getValue("other")); $j->setQues1($this->getValue("ques1")); $j->setQues2($this->getValue("ques2")); $j->setQues3($this->getValue("ques3")); $j->setContactName($this->getValue("contact_name")); $j->setContactPhone($this->getValue("contact_phone")); $j->setContactEmail($this->getValue("contact_email")); $j->setStatusId(sfConfig::get("app_job_status_pending", 1)); $j->setProjectId($this->getValue("project_id")); $j->save(); $body = "Dear {$this->getValue("name")},\r\n\r\nYour job, {$this->getValue("event")}, has been entered into our system. \r\nIf you wish to track the progress of your job, you may do so at http://jobs.tuftsphoto.com \r\n\r\nThanks for using University Photography; we look forward to working with you! \r\n\r\nThe Tufts Photo Team \r\nUniversity Photography\r\n80 George St., First Floor\r\nMedford, MA 02155\r\nTel: 617.627.4282\r\nFax: 617.627.3549\r\nphoto@tufts.edu\r\n\r\n\r\n" . getJobDetails($j); mail($this->getValue("email") . ", photo@tufts.edu", "University Photography Job #" . $j->getId() . " - " . $j->getEvent(), $body, "From: photo@tufts.edu"); $user = sfContext::getInstance()->getUser(); if ($this->getValue("clientId") > 0 && ($user->hasCredential("client") || $user->hasCredential("admin"))) { $client = ClientPeer::retrieveByPK($this->getValue("clientId")); $j->addClient($client); } // if they are a user lets make them a client if ($user->getProfile()->getUserType()->getId() == sfConfig::get("app_user_type_user")) { $clientProfile = new Client(); $clientProfile->setUserId($user->getProfile()->getId()); $clientProfile->setName($this->getValue("name")); $clientProfile->setDepartment($this->getValue("department")); $clientProfile->setAddress($this->getValue("address")); $clientProfile->setEmail($this->getValue("email")); $clientProfile->setPhone($this->getValue("phone")); $clientProfile->save(); $user->getProfile()->setUserTypeId(sfConfig::get("app_user_type_client")); $user->getProfile()->save(); $user->clearCredentials(); $user->addCredential("client"); } else { if ($user->getProfile()->getUserType()->getId() == sfConfig::get("app_user_type_client")) { $c = new Criteria(); $c->add(ClientPeer::USER_ID, $user->getProfile()->getId()); $clientProfile = ClientPeer::doSelectOne($c); if (is_null($clientProfile)) { $clientProfile = new Client(); } $clientProfile->setUserId($user->getProfile()->getId()); $clientProfile->setName($this->getValue("name")); $clientProfile->setDepartment($this->getValue("department")); $clientProfile->setAddress($this->getValue("address")); $clientProfile->setEmail($this->getValue("email")); $clientProfile->setPhone($this->getValue("phone")); $clientProfile->save(); } } if (isset($clientProfile) && !is_null($clientProfile)) { $j->addClient($clientProfile); } return $j->getId(); }
/** * Get the associated Client object * * @param PropelPDO Optional Connection object. * @return Client The associated Client object. * @throws PropelException */ public function getClient(PropelPDO $con = null) { if ($this->aClient === null && $this->client_id !== null) { $this->aClient = ClientPeer::retrieveByPk($this->client_id); /* 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->aClient->addOrders($this); */ } return $this->aClient; }
public function executeCoreEval(sfWebRequest $request) { $this->form = new ReportCoreEvalForm(); if ($request->isMethod('post')) { $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); if ($this->form->isValid()) { $start_date = $this->form->getValue('start_date'); $end_date = $this->form->getValue('end_date'); $this->start_date = strtotime($start_date); $this->end_date = strtotime($end_date); $c = new Criteria(); $c->add(ClientPeer::CREATED_AT, $this->start_date, Criteria::GREATER_EQUAL); $c->addAnd(ClientPeer::CREATED_AT, $this->end_date, Criteria::LESS_EQUAL); $this->clients = ClientPeer::doSelect($c); $this->setTemplate('coreEvalReport'); } } }
protected function execute($arguments = array(), $options = array()) { // initialize the database connection $databaseManager = new sfDatabaseManager($this->configuration); $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection(); // create connection to import database $this->logSection('connection', 'creating connection to import source'); $source = Propel::getConnection($options['source'] ? $options['source'] : null); // create static counties and offices $this->logSection('static', 'creating static counties and offices'); $connection->beginTransaction(); try { OfficePeer::doDeleteAll($connection); $o1 = new Office(); $o1->setName('Plattsburgh'); $o1->save($connection); $o1 = new Office(); $o1->setName('Rouses Point'); $o1->save($connection); CountyPeer::doDeleteAll($connection); $c1 = new County(); $c1->setName('Clinton'); $c1->save($connection); $c1 = new County(); $c1->setName('Essex'); $c1->save($connection); $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // read in and create objects for district, frequency, icd9, job, services tables // DISTRICT $query = 'SELECT * FROM %s'; $query = sprintf($query, 'tbl_district'); $statement = $source->prepare($query); $statement->execute(); $districts = $statement->fetchAll(); $connection->beginTransaction(); try { DistrictPeer::doDeleteAll($connection); foreach ($districts as $district) { $this->logSection('district', 'creating district ' . $district['district_name']); $d1 = new District(); $d1->setName($district['district_name']); $d1->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // FREQUENCY $query = 'SELECT * FROM %s'; $query = sprintf($query, 'tbl_frequency'); $statement = $source->prepare($query); $statement->execute(); $frequencies = $statement->fetchAll(); $connection->beginTransaction(); try { FrequencyPeer::doDeleteAll($connection); foreach ($frequencies as $freq) { $this->logSection('freq', 'reading frequency ' . $freq['freq_title']); $f1 = new Frequency(); $f1->setName($freq['freq_title']); $f1->setDescription($freq['freq_description']); $f1->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // ICD9 $query = 'SELECT * FROM %s'; $query = sprintf($query, 'tbl_icd9'); $statement = $source->prepare($query); $statement->execute(); $icd9s = $statement->fetchAll(); $connection->beginTransaction(); try { Icd9Peer::doDeleteAll($connection); foreach ($icd9s as $icd9) { $this->logSection('icd9', 'reading icd9 ' . $icd9['icd9_value']); $i1 = new Icd9(); $i1->setName($icd9['icd9_value']); $i1->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // JOB $query = 'SELECT * FROM %s'; $query = sprintf($query, 'tbl_job'); $statement = $source->prepare($query); $statement->execute(); $jobs = $statement->fetchAll(); $connection->beginTransaction(); try { JobPeer::doDeleteAll($connection); foreach ($jobs as $job) { $this->logSection('job', 'reading job ' . $job['job_title']); $j1 = new Job(); $j1->setName($job['job_title']); $j1->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // SERVICES $query = 'SELECT * FROM %s'; $query = sprintf($query, 'tbl_services'); $statement = $source->prepare($query); $statement->execute(); $services = $statement->fetchAll(); $connection->beginTransaction(); try { ServicePeer::doDeleteAll($connection); foreach ($services as $service) { $this->logSection('service', 'reading service ' . $service['service_title']); $s1 = new Service(); $s1->setName($service['service_title']); $s1->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // EMPLOYEES $query = 'SELECT * FROM %s LEFT JOIN (%s) ON (%s.emp_job_title = %s.job_id)'; $query = sprintf($query, 'tbl_employee', 'tbl_job', 'tbl_employee', 'tbl_job'); $statement = $source->prepare($query); $statement->execute(); $employees = $statement->fetchAll(); $connection->beginTransaction(); try { EmployeePeer::doDeleteAll($connection); foreach ($employees as $employee) { $this->logSection('employee', 'reading employee ' . $employee['emp_id']); $emp = new Employee(); $emp_fields = array('clearance' => $employee['emp_scr_clearance'], 'first_name' => $employee['emp_fn'], 'middle' => $employee['emp_mi'], 'last_name' => $employee['emp_ln'], 'address' => $employee['emp_address'], 'address_2' => $employee['emp_address2'], 'city' => $employee['emp_city'], 'state' => $employee['emp_state'], 'zip' => $employee['emp_zip'], 'home_phone' => $employee['emp_phone'], 'cell_phone' => $employee['emp_cell'], 'company_email' => $employee['emp_email'], 'personal_email' => $employee['emp_p_email'], 'license_number' => $employee['emp_license_number'], 'license_expiration' => $employee['emp_license_exp'], 'dob' => $employee['emp_dob'], 'doh' => $employee['emp_hire_date'], 'dof' => $employee['emp_end_date'], 'ssn' => $employee['emp_ssn'], 'health_insurance' => $employee['emp_health'], 'retirement_plan' => $employee['emp_401k'], 'suplimental_health' => $employee['emp_health_sup'], 'health_type' => $employee['emp_health_type'], 'tb_date' => $employee['emp_tb'], 'osha_date' => $employee['emp_osha'], 'cpr_date' => $employee['emp_cpr'], 'finger_prints' => $employee['emp_fp'], 'finger_print_notes' => $employee['emp_fp_n'], 'notes' => $employee['emp_notes']); $emp->fromArray($emp_fields, BasePeer::TYPE_FIELDNAME); // find the job - check for errors $emp->setJob(JobPeer::getByName($employee['job_title'])); // if physical has a date then create a new physical object for employee if ($employee['emp_physical']) { $this->logSection('physical', 'employee ' . $employee['emp_fn'] . ' had a physical on ' . $employee['emp_physical']); $ph1 = new Physical(); $ph1->setEmployee($emp); $ph1->setDateGiven($employee['emp_physical']); $ph1->save($connection); } $emp->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // read in and create client objects - linking to employee // CLIENTS $query = 'SELECT * FROM %s LEFT JOIN (%s) ON (%s.client_district = %s.district_id)'; $query = sprintf($query, 'tbl_client', 'tbl_district', 'tbl_client', 'tbl_district'); $statement = $source->prepare($query); $statement->execute(); $clients = $statement->fetchAll(); $connection->beginTransaction(); try { ClientPeer::doDeleteAll($connection); foreach ($clients as $client) { $this->logSection('client', 'reading client ' . $client['client_ln']); $cl = new Client(); $client_fields = array('first_name' => $client['client_fn'], 'last_name' => $client['client_ln'], 'dob' => $client['client_dob'], 'parent_first' => $client['client_parent_fn'], 'parent_last' => $client['client_parent_ln'], 'address' => $client['client_address'], 'address_2' => $client['client_address2'], 'city' => $client['client_city'], 'state' => $client['client_state'], 'zip' => $client['client_zip'], 'home_phone' => $client['home_phone'], 'work_phone' => $client['work_phone'], 'cell_phone' => $client['cell_phone'], 'blue_card' => $client['blue_card'], 'physical_exp' => $client['physical_exp_date'], 'immunizations' => $client['immunizations'], 'waiting_list' => $client['waiting_list']); // county $cl->setCounty(CountyPeer::getByName($client['client_county'])); // district $cl->setDistrict(DistrictPeer::getByName($client['district_name'])); $cl->fromArray($client_fields, BasePeer::TYPE_FIELDNAME); $cl->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // CLIENT SERVICES // CLASSROOM $query = 'SELECT * FROM tbl_classroom LEFT JOIN (tbl_client) ON (tbl_classroom.class_client_id = tbl_client.client_id) LEFT JOIN (tbl_employee) ON (tbl_classroom.class_provider_id = tbl_employee.emp_id) LEFT JOIN (tbl_services) ON (tbl_classroom.class_service_id = tbl_services.service_id) LEFT JOIN (tbl_frequency) ON (tbl_classroom.class_freq_id = tbl_frequency.freq_id)'; $statement = $source->prepare($query); $statement->execute(); $classrooms = $statement->fetchAll(); $connection->beginTransaction(); $c = new Criteria(); $c->add(ClientServicePeer::OBJECT_TYPE, ClientServicePeer::CLASSKEY_CLASSROOM); try { ClientServicePeer::doDelete($c, $connection); foreach ($classrooms as $classroom) { $this->logSection('classroom', 'reading service ' . $classroom['class_id']); $cr_cl = new Classroom(); $cr_cl->setStartDate($classroom['class_start_date']); $cr_cl->setEndDate($classroom['class_exp_date']); $cr_cl->setChangeDate($classroom['class_chng_date']); $cr_cl->setNotes($classroom['class_notes']); // client $cr_cl->setClient(ClientPeer::getByFullName($classroom['client_fn'], $classroom['client_ln'])); // employee $cr_cl->setEmployee(EmployeePeer::getByFullName($classroom['emp_fn'], $classroom['emp_ln'])); // service $cr_cl->setService(ServicePeer::getByName($classroom['service_title'])); // frequency $cr_cl->setFrequency(FrequencyPeer::getByName($classroom['freq_title'])); // office $cr_cl->setOffice(OfficePeer::getByName($classroom['class_location'])); $cr_cl->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // EI $query = 'SELECT * FROM tbl_ei LEFT JOIN (tbl_client) ON (tbl_ei.ei_client_id = tbl_client.client_id) LEFT JOIN (tbl_employee) ON (tbl_ei.ei_provider_id = tbl_employee.emp_id) LEFT JOIN (tbl_services) ON (tbl_ei.ei_service_id = tbl_services.service_id) LEFT JOIN (tbl_frequency) ON (tbl_ei.ei_freq_id = tbl_frequency.freq_id) LEFT JOIN (tbl_icd9) ON (tbl_ei.ei_icd9_id = tbl_icd9.icd9_id)'; $statement = $source->prepare($query); $statement->execute(); $eis = $statement->fetchAll(); $connection->beginTransaction(); $c = new Criteria(); $c->add(ClientServicePeer::OBJECT_TYPE, ClientServicePeer::CLASSKEY_EI); try { ClientServicePeer::doDelete($c, $connection); foreach ($eis as $ei) { $this->logSection('ei', 'reading service ' . $ei['ei_id']); $ei_cl = new Ei(); $ei_cl->setStartDate($ei['ei_start_date']); $ei_cl->setEndDate($ei['ei_exp_date']); $ei_cl->setChangeDate($ei['ei_chng_date']); $ei_cl->setNotes($ei['ei_serv_notes']); $ei_cl->setAuthorization($ei['ei_auth']); $ei_cl->setPhysiciansOrder($ei['ei_p_order']); // client $ei_cl->setClient(ClientPeer::getByFullName($ei['client_fn'], $ei['client_ln'])); // employee $ei_cl->setEmployee(EmployeePeer::getByFullName($ei['emp_fn'], $ei['emp_ln'])); // service $ei_cl->setService(ServicePeer::getByName($ei['service_title'])); // frequency $ei_cl->setFrequency(FrequencyPeer::getByName($ei['freq_title'])); // office $ei_cl->setIcd9(Icd9Peer::getByName($ei['icd9_value'])); $ei_cl->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // PRESCHOOL $query = 'SELECT * FROM tbl_preschool LEFT JOIN (tbl_client) ON (tbl_preschool.pre_client_id = tbl_client.client_id) LEFT JOIN (tbl_employee) ON (tbl_preschool.pre_provider_id = tbl_employee.emp_id) LEFT JOIN (tbl_services) ON (tbl_preschool.pre_service_id = tbl_services.service_id) LEFT JOIN (tbl_frequency) ON (tbl_preschool.pre_freq_id = tbl_frequency.freq_id)'; $statement = $source->prepare($query); $statement->execute(); $preschools = $statement->fetchAll(); $connection->beginTransaction(); $c = new Criteria(); $c->add(ClientServicePeer::OBJECT_TYPE, ClientServicePeer::CLASSKEY_PRESCHOOL); try { ClientServicePeer::doDelete($c, $connection); foreach ($preschools as $preschool) { $this->logSection('preschool', 'reading service ' . $preschool['pre_id']); $pr_cl = new Preschool(); $pr_cl->setStartDate($preschool['pre_start_date']); $pr_cl->setEndDate($preschool['pre_exp_date']); $pr_cl->setChangeDate($preschool['pre_chng_date']); // client $pr_cl->setClient(ClientPeer::getByFullName($preschool['client_fn'], $preschool['client_ln'])); // employee $pr_cl->setEmployee(EmployeePeer::getByFullName($preschool['emp_fn'], $preschool['emp_ln'])); // service $pr_cl->setService(ServicePeer::getByName($preschool['service_title'])); // frequency $pr_cl->setFrequency(FrequencyPeer::getByName($preschool['freq_title'])); $pr_cl->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } // SEIT $query = 'SELECT * FROM tbl_seit LEFT JOIN (tbl_client) ON (tbl_seit.seit_client_id = tbl_client.client_id) LEFT JOIN (tbl_employee) ON (tbl_seit.seit_provider_id = tbl_employee.emp_id) LEFT JOIN (tbl_services) ON (tbl_seit.seit_service_id = tbl_services.service_id) LEFT JOIN (tbl_frequency) ON (tbl_seit.seit_freq_id = tbl_frequency.freq_id)'; $statement = $source->prepare($query); $statement->execute(); $seits = $statement->fetchAll(); $connection->beginTransaction(); $c = new Criteria(); $c->add(ClientServicePeer::OBJECT_TYPE, ClientServicePeer::CLASSKEY_SEIT); try { ClientServicePeer::doDelete($c, $connection); foreach ($seits as $seit) { $this->logSection('seit', 'reading service ' . $seit['seit_id']); $seit_cl = new Seit(); $seit_cl->setStartDate($seit['seit_start_date']); $seit_cl->setEndDate($seit['seit_exp_date']); $seit_cl->setChangeDate($seit['seit_chng_date']); $seit_cl->setNotes($seit['seit_notes']); // client $seit_cl->setClient(ClientPeer::getByFullName($seit['client_fn'], $seit['client_ln'])); // employee $seit_cl->setEmployee(EmployeePeer::getByFullName($seit['emp_fn'], $seit['emp_ln'])); // service $seit_cl->setService(ServicePeer::getByName($seit['service_title'])); // frequency $seit_cl->setFrequency(FrequencyPeer::getByName($seit['freq_title'])); $seit_cl->save($connection); } $connection->commit(); } catch (PropelException $e) { $connection->rollBack(); throw $e; } }
/** * Selects a collection of Order objects pre-filled with all related objects except OrderStatus. * * @param Criteria $criteria * @param PropelPDO $con * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN * @return array Array of Order objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptOrderStatus(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN) { $criteria = clone $criteria; // Set the correct dbName if it has not been overridden // $criteria->getDbName() will return the same object if not set to another value // so == check is okay and faster if ($criteria->getDbName() == Propel::getDefaultDB()) { $criteria->setDbName(self::DATABASE_NAME); } OrderPeer::addSelectColumns($criteria); $startcol2 = OrderPeer::NUM_COLUMNS - OrderPeer::NUM_LAZY_LOAD_COLUMNS; ElementPeer::addSelectColumns($criteria); $startcol3 = $startcol2 + (ElementPeer::NUM_COLUMNS - ElementPeer::NUM_LAZY_LOAD_COLUMNS); ClientPeer::addSelectColumns($criteria); $startcol4 = $startcol3 + (ClientPeer::NUM_COLUMNS - ClientPeer::NUM_LAZY_LOAD_COLUMNS); $criteria->addJoin(OrderPeer::ELEMENT_ID, ElementPeer::ID, $join_behavior); $criteria->addJoin(OrderPeer::CLIENT_ID, ClientPeer::ID, $join_behavior); // symfony_behaviors behavior foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) { call_user_func($sf_hook, 'BaseOrderPeer', $criteria, $con); } $stmt = BasePeer::doSelect($criteria, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = OrderPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = OrderPeer::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 { $cls = OrderPeer::getOMClass(false); $obj1 = new $cls(); $obj1->hydrate($row); OrderPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Element rows $key2 = ElementPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = ElementPeer::getInstanceFromPool($key2); if (!$obj2) { $cls = ElementPeer::getOMClass(false); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); ElementPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (Order) to the collection in $obj2 (Element) $obj2->addOrder($obj1); } // if joined row is not null // Add objects for joined Client rows $key3 = ClientPeer::getPrimaryKeyHashFromRow($row, $startcol3); if ($key3 !== null) { $obj3 = ClientPeer::getInstanceFromPool($key3); if (!$obj3) { $cls = ClientPeer::getOMClass(false); $obj3 = new $cls(); $obj3->hydrate($row, $startcol3); ClientPeer::addInstanceToPool($obj3, $key3); } // if $obj3 already loaded // Add the $obj1 (Order) to the collection in $obj3 (Client) $obj3->addOrder($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
public function executeSidebarEdit(sfWebRequest $request) { $this->client = ClientPeer::retrieveByPk($request->getParameter('id')); }
public function executeNewSchoolAge(sfWebRequest $request) { $this->title = 'School Age'; $client = ClientPeer::retrieveByPK($request->getParameter('client_id')); if (!($last_cs = $client->getLastService())) { $last_cs = new SchoolAge(); } $client_service = new SchoolAge(); $client_service->setEmployee($last_cs->getEmployee()); $client_service->setStartDate($last_cs->getStartDate()); $client_service->setEndDate($last_cs->getEndDate()); $client_service->setClientId($request->getParameter('client_id')); $this->form = new SchoolAgeForm($client_service); $this->setTemplate('new'); }
/** * 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 = ClientPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setFirstName($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setLastName($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setEmail($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setPhone($arr[$keys[4]]); } }
/** * 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(ClientPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(ClientPeer::DATABASE_NAME); $criteria->add(ClientPeer::ID, $pks, Criteria::IN); $objs = ClientPeer::doSelect($criteria, $con); } return $objs; }
public function transformJobs() { $statusHash = array(); $statusObjects = StatusPeer::doSelect(new Criteria()); foreach ($statusObjects as $s) { $statusHash[$s->getState()] = $s->getId(); } $this->jobKeys = array(); $dom = DOMDocument::load("tuftsph_jm2db.xml"); $jobs = $dom->getElementsByTagName("jobs"); $total = $jobs->length; $count = 1; $jobList = array(); foreach ($jobs as $job) { $jid = 0; $childNodes = $job->childNodes; $j = new Job(); $del = new Delivery(); $jid = 1; $startTime = null; $shootStart = null; $shootEnd = null; $endTime = null; $notes = ""; $photog = 0; $slug = ""; $childNodes = $job->childNodes; foreach ($childNodes as $child) { switch ($child->nodeName) { case "id": $jid = $child->textContent; break; case "shoot_name": $j->setEvent($child->textContent); break; case "shoot_date": $j->setDate($child->textContent); break; case "shoot_startT": $startTime = $child->textContent; break; case "shoot_start": $shootStart = $child->textContent; break; case "shoot_endT": $endTime = $child->textContent; break; case "shoot_end": $shootEnd = $child->textContent; break; case "shoot_duedate": $j->setDueDate($child->textContent); break; case "submitted_at": $j->setCreatedAt($child->textContent); break; case "requester_address": $j->setStreet($child->textContent); break; case "requester_campus": $j->setCity($child->textContent); break; case "requester_name": $j->setContactName($child->textContent); break; case "requester_email": $j->setContactEmail($child->textContent); break; case "requester_phone": $j->setContactPhone($child->textContent); break; case "internal_notes": $notes .= $child->textContent . "<br/>"; break; case "billing_notes": $notes .= $child->textContent . "<br/>"; break; case "estimate": $j->setEstimate($child->textContent); break; case "billing_acctnum": $j->setAcctNum($child->textContent); break; case "billing_deptid": $j->setDeptId($child->textContent); break; case "billing_grantid": $j->setGrantId($child->textContent); break; case "shoot_directions": $j->setOther($child->textContent); break; case "status": $j->setStatusId($statusHash[$child->textContent]); break; case "photog_id": $photog = $child->textContent; break; case "delivery_pubname": $del->setPubName($child->textContent); break; case "delivery_pubtype": $del->setPubType($child->textContent); break; case "delivery_other": $del->setOther($child->textContent); break; case "delivery_format": break; case "delivery_color": $del->setColor($child->textContent); break; case "delivery_format": $del->setFormat($child->textContent); break; case "delivery_size": $del->setSize($child->textContent); break; case "delivery_method": $del->setMethod($child->textContent); break; case "delivery_special": $del->setInstructions($child->textContent); break; case "slug": $slug = $child->textContent; break; case "#text": default: break; } } if (is_null($endTime)) { $endTime = $shootEnd; } if (is_null($startTime)) { $startTime = $shootStart; } if ($j->getCity() == "Boston") { $j->setZip("02101"); } else { $j->setZip("02155"); } $j->setNotes($notes); $j->setState("Massachusetts"); list($hour, $min, $sec) = explode(":", $endTime); list($shour, $smin, $ssec) = explode(":", $startTime); $t = new DateTime(); $t->setTime($hour, $min, $sec); $j->setEndTime($t); $t = new DateTime(); $t->setTime($shour, $smin, $ssec); $j->setStartTime($t); $j->addTag($slug); if (isset($this->jobProjectKeys[$jid])) { $j->setProjectId($this->projectKeys[$this->jobProjectKeys[$jid]]); } while (count($jobList) - 1 != $jid) { $jobList[] = false; } $jobList[intval($jid)] = array("job" => $j, "del" => $del, "photog" => $photog); } for ($i = 1; $i < count($jobList); $i++) { sleep(1); $obj = $jobList[$i]; $c = new Criteria(); $c->add(JobPeer::ID, $i); if (JobPeer::doCount($c) > 0) { continue; } echo $i . "/" . $total . "\n"; // keep the ids lined up if ($obj == false) { $myJob = new Job(); try { $myJob->save(); } catch (Exception $ex) { echo $ex->getMessage(); } $myJob->delete(); } else { $j = $obj["job"]; $del = $obj["del"]; $photog = $obj["photog"]; try { $j->save(); } catch (Exception $ex) { echo $ex->getMessage(); echo $ex->getTraceAsString(); } $del->setJobId($j->getId()); $del->save(); $this->jobKeys[$jid] = $j->getId(); if ($photog) { $jp = new JobPhotographer(); $jp->setPhotographerId($this->photogKeys[$photog]); $jp->setJobId($j->getId()); try { $jp->save(); } catch (Exception $ex) { echo $ex->getMessage(); } } // add the requester as a client $c = new Criteria(); $c->add(sfGuardUserPeer::USERNAME, $j->getContactEmail()); if (ClientPeer::doCount($c) == 0 && trim(strlen($j->getContactEmail())) != 0) { $user = new sfGuardUser(); $user->setUsername($j->getContactEmail()); $user->setPassword("admin"); $user->save(); $userProfile = new sfGuardUserProfile(); $userProfile->setUserId($user->getId()); $userProfile->setUserTypeId(sfConfig::get("app_user_type_client")); $userProfile->save(); $clientProfile = new Client(); $clientProfile->setUserId($userProfile->getId()); $clientProfile->setName($j->getContactName()); $clientProfile->setEmail($j->getContactEmail()); $clientProfile->setPhone($j->getContactPhone()); $clientProfile->save(); $jobClient = new JobClient(); $jobClient->setClientId($clientProfile->getId()); $jobClient->setJobId($j->getId()); $jobClient->save(); } } $count += 1; } }
public function executeBillingVoucher(sfWebRequest $request) { $client = ClientPeer::retrieveByPk($request->getParameter('id')); $this->forward404Unless($client); // create the document $doc = new sfTinyDoc(); $doc->createFrom(); $doc->loadXml('content.xml'); $doc->mergeXmlField('client', $client); $doc->saveXml(); $doc->close(); // send and remove the document $doc->sendResponse(); $doc->remove(); throw new sfStopException(); }
public function reap($try_to_do_global = true) { return ClientPeer::reap($this->getClients(), $try_to_do_global); }
/** * Executes the create action. * Displays a form to the user or deals with the save. * * @param sfWebRequest $request */ public function executeCreate(sfWebRequest $request) { $this->isAdmin = $this->getUser()->hasCredential("admin"); $this->form = new RequestJobForm(); $this->attachForm = new JobAttachmentFormCustom(); if ($this->getUser()->getProfile()->getUserTypeId() == sfConfig::get("app_user_type_client")) { $c = new Criteria(); $c->add(ClientPeer::USER_ID, $this->getUser()->getProfile()->getId()); $profile = ClientPeer::doSelectOne($c); $this->isReadonly = !is_null($profile); } else { $profile = null; $this->isReadonly = false; } if ($request->isMethod("POST")) { $this->processForm($request, $this->form, $this->attachForm); } else { if (!is_null($profile)) { $this->form->setDefault("name", $profile->getName()); $this->form->setDefault("department", $profile->getDepartment()); $this->form->setDefault("address", $profile->getAddress()); $this->form->setDefault("email", $profile->getEmail()); $this->form->setDefault("phone", $profile->getPhone()); $this->form->setDefault("clientId", $profile->getId()); } } }
/** * 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 = ClientPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setUserId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setName($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setDepartment($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setAddress($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setEmail($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setPhone($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setSlug($arr[$keys[7]]); } }
/** * Selects a collection of JobClient objects pre-filled with all related objects except Job. * * @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 JobClient objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAllExceptJob(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); } JobClientPeer::addSelectColumns($c); $startcol2 = JobClientPeer::NUM_COLUMNS - JobClientPeer::NUM_LAZY_LOAD_COLUMNS; ClientPeer::addSelectColumns($c); $startcol3 = $startcol2 + (ClientPeer::NUM_COLUMNS - ClientPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(JobClientPeer::CLIENT_ID), array(ClientPeer::ID), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = JobClientPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = JobClientPeer::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 = JobClientPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); JobClientPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined Client rows $key2 = ClientPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = ClientPeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = ClientPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); ClientPeer::addInstanceToPool($obj2, $key2); } // if $obj2 already loaded // Add the $obj1 (JobClient) to the collection in $obj2 (Client) $obj2->addJobClient($obj1); } // if joined row is not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Returns the number of related Client objects. * * @param Criteria $criteria * @param boolean $distinct * @param PropelPDO $con * @return int Count of related Client objects. * @throws PropelException */ public function countClients(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(sfGuardUserProfilePeer::DATABASE_NAME); } else { $criteria = clone $criteria; } if ($distinct) { $criteria->setDistinct(); } $count = null; if ($this->collClients === null) { if ($this->isNew()) { $count = 0; } else { $criteria->add(ClientPeer::USER_ID, $this->id); $count = ClientPeer::doCount($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 count of the collection. $criteria->add(ClientPeer::USER_ID, $this->id); if (!isset($this->lastClientCriteria) || !$this->lastClientCriteria->equals($criteria)) { $count = ClientPeer::doCount($criteria, $con); } else { $count = count($this->collClients); } } else { $count = count($this->collClients); } } return $count; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = ClientPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setLabel($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setAddress($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setCreatedAt($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setUpdatedAt($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setPublicationStatus($arr[$keys[5]]); } }
public function executeAnnounce($request) { register_shutdown_function(array($this, "timeout"), $request); $this->encoder = new File_Bittorrent2_Encode(); try { if (!SettingPeer::retrieveByKey('tracker_active')) { throw new limeException('turn-on-tracker', 'Tracker not active'); } $response = $this->response_ok; $this->form = new ClientForm(); $this->form->bind($request->getGetParameters()); if (!$this->form->isValid()) { return $this->doError(implode(';\\n', $this->form->getValidatorSchema()->getMessages())); } $params = $request->getGetParameters(); $params['info_hash'] = unpack('H*', $params['info_hash']); $params['info_hash'] = $params['info_hash'][1]; $params['peer_id'] = $params['peer_id']; $request->setTimeLimit(10); $my_client = ClientPeer::retrieveByParameters($params); $request->setIgnoreUserAbort(true); // semi-transactional now $my_client->updateWithParameters($params, $request); if (!$my_client->isDeleted()) { $my_client->save(); $torrent = $my_client->getTorrent(); $clients = ClientPeer::reap($torrent->getClients()); $request->setIgnoreUserAbort(false); $request->setTimeLimit(20); if (!isset($params['compact'])) { $params['compact'] = TRUE; } if ($params['compact']) { $response['peers'] = ''; } $complete = 0; $incomplete = 0; foreach ($clients as $peer_client) { if ($my_client->getId() != $peer_client->getId() && !$peer_client->isDeleted()) { if ($peer_client->isComplete()) { $complete++; } else { $incomplete++; } if ($params['compact']) { $response['peers'] .= $peer_client->getDict(true); } else { $response['peers'][] = $peer_client->getDict(); } } } } else { $request->setIgnoreUserAbort(false); $request->setTimeLimit(20); unset($response['peers']); // no need to send a stopping peer a list of peers } $response['tracker id'] = $my_client->getTrackerId(); $response['complete'] = $complete; $response['incomplete'] = $incomplete; // return sfView::ERROR; sfConfig::set('sf_web_debug', false); //return $this->renderText(print_r($response,true)); $output = $this->encoder->encode($response); return $this->renderText($output); } catch (Exception $e) { return $this->doError($e . ''); } }
public function getTimesheetClients(Criteria $c) { $c->add(ClientServicePeer::EMPLOYEE_ID, $this->getId()); return ClientPeer::doSelect($c); }
/** * Executes index action * * @param sfRequest $request A request object */ public function executeIndex(sfWebRequest $request) { $this->page = $this->getRequest()->getParameter("page"); $this->sortedBy = $this->getRequest()->getParameter("sortBy"); $this->invert = $this->getRequest()->getParameter("invert"); $own = $request->getParameter("own"); $all = $request->getParameter("all"); $this->all = $all; $this->own = $own; $profile = $this->getUser()->getProfile(); if (is_null($all)) { $all = false; } if (is_null($own)) { $own = false; } $c = new Criteria(); if ($own) { $crit = new Criteria(); $crit->add(ClientPeer::USER_ID, $profile->getId()); $client = ClientPeer::doSelectOne($crit); if (is_null($client)) { $this->forward404("Please contact Tufts Photo support."); } $crit = new Criteria(); $ids = array(); $crit->add(JobClientPeer::CLIENT_ID, $client->getId()); $jobs = JobClientPeer::doSelectJoinAll($crit); foreach ($jobs as $ph) { $ids[] = $ph->getJobId(); } $c->add(JobPeer::ID, $ids, Criteria::IN); } else { // $c->add(JobPeer::STATUS_ID, sfConfig::get("job_status_pending")); $c = new Criteria(); $crit0 = $c->getNewCriterion(JobPeer::STATUS_ID, sfConfig::get("app_job_status_pending")); $crit1 = $c->getNewCriterion(JobPeer::STATUS_ID, sfConfig::get("app_job_status_accepted")); $crit2 = $c->getNewCriterion(JobPeer::STATUS_ID, sfConfig::get("app_job_status_completed")); // Perform OR at level 0 ($crit0 $crit1 $crit2 ) $crit0->addOr($crit1); $crit0->addOr($crit2); // Remember to change the peer class here for the correct one in your model $c->add($crit0); } // restrict to only their jobs if they are photogs if ($profile->getUserType()->getId() == sfConfig::get("app_user_type_photographer")) { $crit = new Criteria(); $crit->add(PhotographerPeer::USER_ID, $profile->getId()); $photo = PhotographerPeer::doSelectOne($crit); if (is_null($photo)) { $this->forward404("Please contact Tufts Photo support."); } $crit = new Criteria(); $crit->add(JobPhotographerPeer::PHOTOGRAPHER_ID, $photo->getId()); $ids = array(); $photos = JobPhotographerPeer::doSelectJoinAll($crit); foreach ($photos as $ph) { $ids[] = $ph->getJobId(); } $c->add(JobPeer::ID, $ids, Criteria::IN); } if (is_null($this->sortedBy)) { $this->sortedBy = JobPeer::DATE; } if (is_null($this->invert) || $this->invert == "false") { $this->invert = false; $c->addAscendingOrderByColumn($this->sortedBy); } else { $c->addDescendingOrderByColumn($this->sortedBy); $this->invert = true; } if (!is_numeric($this->page)) { $this->page = 1; } $this->pager = new sfPropelPager("Job", sfConfig::get("app_items_per_page")); $this->pager->setCriteria($c); $this->pager->setPage($this->page); $this->pager->setPeerMethod("doSelectJoinAll"); $this->pager->init(); $this->results = $this->pager->getResults(); sfPropelActAsTaggableBehavior::preloadTags($this->results); $sortUrls = array(); foreach (JobPeer::$LIST_VIEW_SORTABLE as $key => $val) { $sortUrls[$key]["true"] = $this->generateUrl("client_myjobs_own", array("own" => $own, "all" => $all, "sortBy" => $key, "invert" => "true")); $sortUrls[$key]["false"] = $this->generateUrl("client_myjobs_own", array("own" => $own, "all" => $all, "sortBy" => $key, "invert" => "false")); } $this->sortUrlJson = json_encode($sortUrls); }
/** * Get the associated Client object * * @param PropelPDO Optional Connection object. * @return Client The associated Client object. * @throws PropelException */ public function getClient(PropelPDO $con = null) { if ($this->aClient === null && $this->client_id !== null) { $c = new Criteria(ClientPeer::DATABASE_NAME); $c->add(ClientPeer::ID, $this->client_id); $this->aClient = ClientPeer::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->aClient->addJobClients($this); */ } return $this->aClient; }