本文整理汇总了PHP中Address::setType方法的典型用法代码示例。如果您正苦于以下问题:PHP Address::setType方法的具体用法?PHP Address::setType怎么用?PHP Address::setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Address
的用法示例。
在下文中一共展示了Address::setType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetType
/**
* Tests the `setType` method.
*
* @return void
* @access public
*/
public function testSetType()
{
$this->assertIdentical($this->_object->getType(), 'to');
// Confirm the type has been changed from our default.
$this->_object->setType('cc');
$this->assertIdentical($this->_object->getType(), 'cc');
// This should fail since it's an invalid type.
$this->expectException();
$this->_object->setType('fail');
}
示例2: testSetType
/**
* Tests Address->setType()
*/
public function testSetType()
{
$this->Address->setType('type');
$this->assertEquals('type', $this->Address->type);
}
示例3: getPeople
//.........这里部分代码省略.........
//'A' we haven`t activities yet
/*$res2 = mysqli_query($this->db, "select activity from person_activities where person_id = " . $person_id);
while (list($activity) = @mysqli_fetch_row($res2)) {
$activities[] = $activity;
}*/
$person->setActivities($activities);
}
if (isset($fields['addresses']) || in_array('@all', $fields)) {
$addresses = array();
$sCountry = isset($row['Country']) ? $row['Country'] : '';
$sRegion = isset($row['City']) ? $row['City'] : '';
//'A' region -> city
$sZip = isset($row['zip']) ? $row['zip'] : '';
if (empty($row['unstructured_address'])) {
$row['unstructured_address'] = trim($row['street_address'] . " " . $sRegion . " " . $sCountry);
}
$addres = new Address($row['unstructured_address']);
$addres->setCountry($sCountry);
if (!empty($row['latitude'])) {
$addres->setLatitude($row['latitude']);
}
if (!empty($row['longitude'])) {
$addres->setLongitude($row['longitude']);
}
if (!empty($row['locality'])) {
$addres->setLocality($row['locality']);
}
$addres->setPostalCode($sZip);
$addres->setRegion($sRegion);
if (!empty($row['street_address'])) {
$addres->setStreetAddress($row['street_address']);
}
if (!empty($row['street_address'])) {
$addres->setType($row['street_address']);
}
//FIXME quick and dirty hack to demo PC
$addres->setPrimary(true);
$addresses[] = $addres;
$person->setAddresses($addresses);
}
if (isset($fields['bodyType']) || in_array('@all', $fields)) {
//'A' we haven`t bodyType at all
/*$res2 = mysqli_query($this->db, "select * from person_body_type where person_id = " . $person_id);
if (@mysqli_num_rows($res2)) {
$row = @mysql_fetch_array($res2, MYSQLI_ASSOC);
$bodyType = new BodyType();
$bodyType->setBuild($row['build']);
$bodyType->setEyeColor($row['eye_color']);
$bodyType->setHairColor($row['hair_color']);
$bodyType->setHeight($row['height']);
$bodyType->setWeight($row['weight']);
$person->setBodyType($bodyType);
}*/
}
if (isset($fields['books']) || in_array('@all', $fields)) {
//'A' we haven`t books at all
/*$books = array();
$res2 = mysqli_query($this->db, "select book from person_books where person_id = " . $person_id);
while (list($book) = @mysqli_fetch_row($res2)) {
$books[] = $book;
}
$person->setBooks($books);*/
}
if (isset($fields['cars']) || in_array('@all', $fields)) {
//'A' we haven`t cars at all
/*$cars = array();
示例4: newAddress
/**
* @param $name string
* @param $type string
* @param $value string
* @param string $description
* @return Address
* @throws Exception
*/
public function newAddress($name, $type, $value, $description = '')
{
$found = $this->find($name, null, true);
if ($found !== null) {
derr("cannot create Address named '" . $name . "' as this name is already in use");
}
$newObject = new Address($name, $this, true);
$newObject->setType($type);
$newObject->setValue($value);
$newObject->setDescription($description);
$this->add($newObject);
return $newObject;
}
示例5: executeUpdate
public function executeUpdate()
{
if (!$this->getRequestParameter('id')) {
$addressh = new Address();
$addressh->setType('0');
} else {
$addressh = AddressPeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($addressh);
}
$addressh->setUserId($this->getRequestParameter('user_id') ? $this->getRequestParameter('user_id') : null);
$addressh->setAddress($this->getRequestParameter('address'));
$addressh->setAddressflag($this->getRequestParameter('addressflag'));
$addressh->setCity($this->getRequestParameter('city'));
$addressh->setCityflag($this->getRequestParameter('cityflag'));
$addressh->setState($this->getRequestParameter('state'));
$addressh->setStateflag($this->getRequestParameter('stateflag'));
$addressh->setCountry($this->getRequestParameter('country'));
$addressh->setCountryflag($this->getRequestParameter('countryflag'));
$addressh->setPostalcode($this->getRequestParameter('postalcode'));
$addressh->setPostalcodeflag($this->getRequestParameter('postalcodeflag'));
$addressh->setPhone1($this->getRequestParameter('phone1'));
$addressh->setPhone1flag($this->getRequestParameter('phone1flag'));
$addressh->setPhone2($this->getRequestParameter('phone2'));
$addressh->setPhone2flag($this->getRequestParameter('phone2flag'));
$addressh->setCellphone($this->getRequestParameter('cellphone'));
$addressh->setCellphoneflag($this->getRequestParameter('cellphoneflag'));
$addressh->setFax($this->getRequestParameter('fax'));
$addressh->setFaxflag($this->getRequestParameter('faxflag'));
$addressh->save();
if (!$this->getRequestParameter('id2')) {
$addressw = new Address();
$addressw->setType('1');
} else {
$addressw = AddressPeer::retrieveByPk($this->getRequestParameter('id2'));
$this->forward404Unless($addressw);
}
$addressw->setUserId($this->getRequestParameter('user_id') ? $this->getRequestParameter('user_id') : null);
$addressw->setAddress($this->getRequestParameter('address2'));
$addressw->setAddressflag($this->getRequestParameter('addressflag2'));
$addressw->setCity($this->getRequestParameter('city2'));
$addressw->setCityflag($this->getRequestParameter('cityflag2'));
$addressw->setState($this->getRequestParameter('state2'));
$addressw->setStateflag($this->getRequestParameter('stateflag2'));
$addressw->setCountry($this->getRequestParameter('country2'));
$addressw->setCountryflag($this->getRequestParameter('countryflag2'));
$addressw->setPostalcode($this->getRequestParameter('postalcode2'));
$addressw->setPostalcodeflag($this->getRequestParameter('postalcodeflag2'));
$addressw->setPhone1($this->getRequestParameter('phone12'));
$addressw->setPhone1flag($this->getRequestParameter('phone1flag2'));
$addressw->setPhone2($this->getRequestParameter('phone22'));
$addressw->setPhone2flag($this->getRequestParameter('phone2flag2'));
$addressw->setCellphone($this->getRequestParameter('cellphone2'));
$addressw->setCellphoneflag($this->getRequestParameter('cellphoneflag2'));
$addressw->setFax($this->getRequestParameter('fax2'));
$addressw->setFaxflag($this->getRequestParameter('faxflag2'));
$addressw->save();
if (!$this->getRequestParameter('id3')) {
$addressp = new Address();
$addressp->setType('2');
} else {
$addressp = AddressPeer::retrieveByPk($this->getRequestParameter('id3'));
$this->forward404Unless($addressp);
}
$addressp->setUserId($this->getRequestParameter('user_id') ? $this->getRequestParameter('user_id') : null);
$addressp->setAddress($this->getRequestParameter('address3'));
$addressp->setAddressflag($this->getRequestParameter('addressflag3'));
$addressp->setCity($this->getRequestParameter('city3'));
$addressp->setCityflag($this->getRequestParameter('cityflag3'));
$addressp->setState($this->getRequestParameter('state3'));
$addressp->setStateflag($this->getRequestParameter('stateflag3'));
$addressp->setCountry($this->getRequestParameter('country3'));
$addressp->setCountryflag($this->getRequestParameter('countryflag3'));
$addressp->setPostalcode($this->getRequestParameter('postalcode3'));
$addressp->setPostalcodeflag($this->getRequestParameter('postalcodeflag3'));
$addressp->setPhone1($this->getRequestParameter('phone13'));
$addressp->setPhone1flag($this->getRequestParameter('phone1flag3'));
$addressp->setPhone2($this->getRequestParameter('phone23'));
$addressp->setPhone2flag($this->getRequestParameter('phone2flag3'));
$addressp->setCellphone($this->getRequestParameter('cellphone3'));
$addressp->setCellphoneflag($this->getRequestParameter('cellphoneflag3'));
$addressp->setFax($this->getRequestParameter('fax3'));
$addressp->setFaxflag($this->getRequestParameter('faxflag3'));
$addressp->save();
return $this->redirect('address/show');
}
示例6: convertAddress
/**
* Converts the address fetched from the database to the Address object.
*/
private function convertAddress($row)
{
$formatted = $row['unstructured_address'];
if (empty($formatted)) {
$formatted = trim($row['street_address'] . " " . $row['region'] . " " . $row['country']);
$formatted = empty($formatted) ? $formatted : null;
}
$address = new Address($formatted);
$address->setCountry($row['country']);
$address->setLatitude($row['latitude']);
$address->setLongitude($row['longitude']);
$address->setLocality($row['locality']);
$address->setPostalCode($row['postal_code']);
$address->setRegion($row['region']);
$address->setStreetAddress($row['street_address']);
$address->setType($row['address_type']);
$address->setUnstructuredAddress($row['unstructured_address']);
$address->setExtendedAddress($row['extended_address']);
$address->setPoBox($row['po_box']);
return $address;
}
示例7: getPeople
//.........这里部分代码省略.........
$strings = explode(',', $row['interests']);
$person->setInterests($strings);
}
//TODO: Not in ATutor yet, skeleton field
if (!empty($row['smoker'])) {
$person->setSmoker($row['smoker']);
}
/* the following fields require additional queries so are only executed if requested */
if (isset($fields['activities']) || isset($fields['@all'])) {
$activities = array();
$sql = "select title from " . TABLE_PREFIX . "social_activities where member_id = " . $member_id;
$res2 = mysql_query($sql, $this->db);
while (list($activity) = mysql_fetch_row($res2)) {
$activities[] = $activity;
}
$person->setActivities($activities);
}
if (isset($fields['addresses']) || isset($fields['@all'])) {
$addresses = array();
$sql = "select address, postal, city, province, country from " . TABLE_PREFIX . "members m where m.member_id = " . $member_id;
$res2 = mysql_query($sql, $this->db);
while ($row = mysql_fetch_assoc($res2)) {
if (empty($row['unstructured_address'])) {
$row['unstructured_address'] = trim($row['street_address'] . " " . $row['province'] . " " . $row['country']);
}
$addres = new Address($row['unstructured_address']);
$addres->setCountry($row['country']);
$addres->setLatitude($row['latitude']);
$addres->setLongitude($row['longitude']);
$addres->setLocality($row['locality']);
$addres->setPostalCode($row['postal_code']);
$addres->setRegion($row['province']);
$addres->setStreetAddress($row['street_address']);
$addres->setType($row['address_type']);
//FIXME quick and dirty hack to demo PC
$addres->setPrimary(true);
$addresses[] = $addres;
}
$person->setAddresses($addresses);
}
//TODO: Not in ATutor yet, skeleton field
/*
if (isset($fields['bodyType']) || isset($fields['@all'])) {
$res2 = mysql_query($db, "select * from ".TABLE_PREFIX."person_body_type where person_id = " . $person_id);
if (@mysql_num_rows($res2)) {
$row = @mysql_fetch_assic($res2);
$bodyType = new BodyType();
$bodyType->setBuild($row['build']);
$bodyType->setEyeColor($row['eye_color']);
$bodyType->setHairColor($row['hair_color']);
$bodyType->setHeight($row['height']);
$bodyType->setWeight($row['weight']);
$person->setBodyType($bodyType);
}
}
*/
//TODO: Not in ATutor yet, skeleton field
/*
if (isset($fields['books']) || isset($fields['@all'])) {
$books = array();
$res2 = mysqli_query($db, "select book from ".TABLE_PREFIX."person_books where person_id = " . $person_id);
while (list($book) = @mysqli_fetch_row($res2)) {
$books[] = $book;
}
$person->setBooks($books);
}