本文整理汇总了PHP中Address::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Address::toArray方法的具体用法?PHP Address::toArray怎么用?PHP Address::toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Address
的用法示例。
在下文中一共展示了Address::toArray方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compare
public static function compare(Address $a, Address $b)
{
if ($a->toArray() == $b->toArray()) {
return true;
}
return false;
}
示例2: toArray
/**
* Exports the object as an array.
*
* You can specify the key type of the array by passing one of the class
* type constants.
*
* @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME.
* @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
* @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
*
* @return array an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['Domain'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['Domain'][$this->getPrimaryKey()] = true;
$keys = DomainPeer::getFieldNames($keyType);
$result = array($keys[0] => $this->getId(), $keys[1] => $this->getAccountId(), $keys[2] => $this->getAddressId(), $keys[3] => $this->getName(), $keys[4] => $this->getValid(), $keys[5] => $this->getDescription(), $keys[6] => $this->getNumber());
if ($includeForeignObjects) {
if (null !== $this->aAccount) {
$result['Account'] = $this->aAccount->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
if (null !== $this->aAddress) {
$result['Address'] = $this->aAddress->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
if (null !== $this->collHolidayDomains) {
$result['HolidayDomains'] = $this->collHolidayDomains->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collPropertyValues) {
$result['PropertyValues'] = $this->collPropertyValues->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collUsers) {
$result['Users'] = $this->collUsers->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
}
return $result;
}
示例3: calculateTax
public function calculateTax()
{
if (!$this->hasLines()) {
throw new Exception(self::ERROR_NO_LINES);
}
if (!$this->hasDestinationAddress()) {
throw new Exception(self::ERROR_NO_DESTINATION_ADDRESS);
}
if (empty($this->document_key)) {
throw new Exception(self::ERROR_NO_DOCUMENT_KEY);
}
$data = array('DocumentKey' => Taxify::toString($this->document_key), 'TaxDate' => empty($this->tax_date) ? date('Y-m-d') : $this->tax_date, 'IsCommited' => $this->is_committed, 'CustomerKey' => Taxify::toString($this->customer_key), 'CustomerTaxabilityCode' => Taxify::toString($this->customer_taxability_code), 'CustomerRegistrationNumber' => Taxify::toString($this->customer_registration_number), 'DestinationAddress' => $this->destination_address->toArray(), 'Lines' => array(), 'Options' => array(), 'Tags' => array(), 'Discounts' => array());
if ($this->origin_address !== NULL) {
$data['OriginAddress'] = $this->origin_address->toArray();
}
foreach ($this->lines as $line) {
$data['Lines'][] = $line->toArray();
}
if (!empty($this->tax_request_options)) {
foreach ($this->tax_request_options as $tax_request_option) {
$data['Options'][] = $tax_request_option->toArray();
}
}
if (!empty($this->tags)) {
foreach ($this->tags as $tag) {
$data['Tags'][] = $tag->toArray();
}
}
if (!empty($this->discounts)) {
foreach ($this->discounts as $discount) {
$data['Discounts'][] = $discount->toArray();
}
}
$communicator = new Communicator($this->taxify);
$return = $communicator->call(self::CALL_CALCULATE_TAX, $data);
return new TaxResponse(json_encode($return));
}
示例4: toArray
/**
* Exports the object as an array.
*
* You can specify the key type of the array by passing one of the class
* type constants.
*
* @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME.
* @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
* @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
*
* @return array an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
{
if (isset($alreadyDumpedObjects['Account'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['Account'][$this->getPrimaryKey()] = true;
$keys = AccountPeer::getFieldNames($keyType);
$result = array($keys[0] => $this->getId(), $keys[1] => $this->getAddressId(), $keys[2] => $this->getIdentifier(), $keys[3] => $this->getName());
if ($includeForeignObjects) {
if (null !== $this->aAddress) {
$result['Address'] = $this->aAddress->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
if (null !== $this->collBookingTypes) {
$result['BookingTypes'] = $this->collBookingTypes->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collClockingTypes) {
$result['ClockingTypes'] = $this->collClockingTypes->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collDomains) {
$result['Domains'] = $this->collDomains->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collHolidays) {
$result['Holidays'] = $this->collHolidays->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collPlugins) {
$result['Plugins'] = $this->collPlugins->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collPropertys) {
$result['Propertys'] = $this->collPropertys->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collUsers) {
$result['Users'] = $this->collUsers->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
}
return $result;
}
示例5: toArray
/**
* Convert to array
* @return array
*/
public function toArray()
{
$array = array('id_courtyard' => $this->getIdCourtyard(), 'id_address' => $this->getIdAddress(), 'id_port_custom' => $this->getIdPortCustom(), 'id_forwarder' => $this->getIdForwarder(), 'id_contact' => $this->getIdContact(), 'name' => utf8_encode($this->getName()), 'status' => $this->getStatus());
return array_merge(parent::toArray(), $array);
}
示例6: get
/**
* retrieve an \Address with caching
* @name get
* @param string $address address to retrive object for
* @param boolean $refresh if true forces refreshing of entry in cache
* @since 0.1.0
* @return \MariaBlockChain\Address
*
* <code>
* <?php
* $address = $blockchain->addresses->get('1124fWAtrp31Apd35zkoYqw2jRerE97HE4');
* ?>
* </code>
*/
public function get($address, $refresh = false)
{
if ($address) {
$cached = $this->bc->cache->get((string) $address);
if ($cached !== false && $refresh === false) {
$address = new Address($this->bc, $cached);
} else {
$address = new Address($this->bc, (string) $address);
$this->updateCached((string) $address, $address->toArray());
}
return $address;
}
}
示例7: getValidator
/**
* Return instance of Illuminate\Validation\Validator that is setup with Address rules and data (from html input)
* Addresses::getValidator()->fails(); // test input from user
*
* @param array $input input array from user (or null to default to Input::all())
* @return Illuminate\Validation\Validator ready to test for fails|passes
*/
function getValidator($input = null)
{
$rules = Address::rules();
if (is_null($input)) {
$input = \Input::all();
}
$address = new Address($input);
return \Validator::make($address->toArray(), $rules);
}