本文整理汇总了PHP中Contact::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::toArray方法的具体用法?PHP Contact::toArray怎么用?PHP Contact::toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact::toArray方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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['User'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['User'][$this->getPrimaryKey()] = true;
$keys = UserPeer::getFieldNames($keyType);
$result = array($keys[0] => $this->getId(), $keys[1] => $this->getPasswordResetKey(), $keys[2] => $this->getSfGuardUserId(), $keys[3] => $this->getContactId(), $keys[4] => $this->getActive(), $keys[5] => $this->getCreatedAt(), $keys[6] => $this->getUpdatedAt());
if ($includeForeignObjects) {
if (null !== $this->aContact) {
$result['Contact'] = $this->aContact->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
if (null !== $this->asfGuardUser) {
$result['sfGuardUser'] = $this->asfGuardUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
if (null !== $this->collSessions) {
$result['Sessions'] = $this->collSessions->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collSingleSignOnKeys) {
$result['SingleSignOnKeys'] = $this->collSingleSignOnKeys->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collSystemEventSubscriptions) {
$result['SystemEventSubscriptions'] = $this->collSystemEventSubscriptions->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
if (null !== $this->collSystemEventInstances) {
$result['SystemEventInstances'] = $this->collSystemEventInstances->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
}
return $result;
}
示例2: toArray
/**
* @return array
*/
public function toArray()
{
$data = [];
if ($this->allowedPaymentInstruments) {
$data['allowed_payment_instruments'] = $this->allowedPaymentInstruments;
}
if ($this->defaultPaymentInstrument) {
$data['default_payment_instrument'] = $this->defaultPaymentInstrument;
}
if ($this->defaultSwift) {
$data['default_swift'] = $this->defaultSwift;
}
if ($this->allowedSwifts) {
$data['allowed_swifts'] = $this->allowedSwifts;
}
if ($this->contact) {
$data['contact'] = $this->contact->toArray();
}
return $data;
}
示例3: toArray
public function toArray()
{
return self::array_filter_null(array_merge(array('title' => $this->title, 'description' => $this->description, 'termsOfService' => $this->termsofservice, 'contact' => $this->contact ? $this->contact->toArray() : null, 'license' => $this->license ? $this->license->toArray() : null, 'version' => $this->version), parent::toArray()));
}
示例4: getExternalContractVariables
private function getExternalContractVariables($contract)
{
$contractData = $contract->toArray();
$contractData = sanatizeBeanArrayForLatex($contractData);
$contact = new Contact();
if ($contact->retrieve($contract->clientcontact_id)) {
$contractData['clientcontactperson'] = $contact->toArray();
}
$contact = new Contact();
if ($contact->retrieve($contract->technicalcontact_id)) {
$contractData['technicalcontactperson'] = $contact->toArray();
}
$contact = new Contact();
if ($contact->retrieve($contract->contact_id)) {
$contractData['contactperson'] = $contact->toArray();
}
$account = new Account();
if ($account->retrieve($contract->account_id)) {
$contractData['account'] = $account->toArray();
}
global $timedate;
$contractData['startdate'] = $timedate->to_display_date($contract->startdate);
$contractData['minimumduration'] = $timedate->to_display_date($contract->minimumduration);
global $app_list_strings;
if ($contract->endperiod == 'other') {
$contractData['endperiod'] = $timedate->to_display_date($contract->enddate);
} else {
$contractData['endperiod'] = $app_list_strings['endperiod_list'][$contract->endperiod];
}
if ($contract->cancellationperiod == 'other') {
$contractData['cancellationperiod'] = $timedate->to_display_date($contract->cancellationdate);
} else {
$contractData['cancellationperiod'] = $app_list_strings['cancellationperiod_list'][$contract->cancellationperiod];
}
// show address linebreaks in pdf
$contractData['deliveryaddress'] = preg_replace("/\n/", '\\newline ', $contract->deliveryaddress);
$contractData['completionaddress'] = preg_replace("/\n/", '\\newline ', $contract->completionaddress);
$contractData['svnumbers'] = $contract->getSVNumbersArray();
// TODO: abbreviation and type probably have to be converted in the future
$contractMatters = explode('^,^', $contract->externalcontractmatter);
foreach ($contractMatters as &$matter) {
$matter = $app_list_strings['externalcontractmatter_list'][$matter];
}
$contractData['externalcontractmatter'] = implode('\\newline ', $contractMatters);
$previousCategory = '';
$costs = $contract->getCostsArray();
$months = getLanguageStringsPHP('months');
foreach ($costs as &$cost) {
$cost['numberOfDetailedCosts'] = count($cost['detailedCosts']);
if ($previousCategory == $cost['category']) {
$previousCategory = $cost['category'];
$cost['category'] = '';
// TODO @LION i guess that leaving the category field empty should to some kind of marking... please comment.
} else {
$previousCategory = $cost['category'];
$cost['category'] = $app_list_strings['externalcontractmatter_list'][$cost['category']];
}
if ('annually' === $cost['paymentinterval'] || 'once' === $cost['paymentinterval'] || 'other' === $cost['paymentinterval']) {
$enddate = date_parse($contract->enddate);
// if the payment interval of this cost is once, annually or other, there will be only one detailed cost row.
// so it is correct to modify the first detailed cost item in the array.
// set the month for this detailed cost row to the month of the enddate.
$cost['detailedCosts'][0]['month'] = $enddate['month'];
}
// do translation now because paymentinterval will not be read from php code anymore.
// so it can be in localized form from now on.
$cost['paymentinterval'] = $app_list_strings['paymentinterval_list'][$cost['paymentinterval']];
foreach ($cost['detailedCosts'] as &$detailedCosts) {
$detailedCosts['price'] = formatCurrencyForSmartyLatex($detailedCosts['price'], false);
// format price for latex template (see #387)
}
}
$positions = $contract->getPositionsArray();
foreach ($positions as &$position) {
$position['type'] = $app_list_strings['externalcontractmatter_list'][$position['type']];
$position['price'] = formatCurrencyForSmartyLatex($position['price'], false);
// format price for latex template (see #387)
}
// convert all currency values / prices before giving them to smarty
$contractData['finalcosts'] = formatCurrencyForSmartyLatex($contractData['finalcosts'], true);
return array('numberOfCosts' => count($costs), 'months' => $months, 'contract' => $contractData, 'costs' => $costs, 'positions' => $positions, 'currencySymbol' => currencySymbolToLatexEquivalent(getSugarCrmLocale('default_currency_symbol')));
}
示例5: isset
<?php
include '../../globals.php';
$messageId = $_GET['id'];
$message;
if (isset($messageId)) {
$messageEntity = ContactRepository::FindById('contact', $messageId);
$message = new Contact($messageEntity->id, $messageEntity->name, $messageEntity->firstname, $messageEntity->email, $messageEntity->phone, $messageEntity->comment);
}
echo isset($message) == true ? json_encode($message->toArray()) : json_encode('There was an error while processing the retrieval og this message');
示例6: getContractVariables
function getContractVariables($contract)
{
$contractData = sanatizeBeanArrayForLatex($contract->toArray(true));
$clientContact = new Contact();
if ($clientContact->retrieve($contract->clientcontact_id)) {
$contractData['clientContact'] = sanatizeBeanArrayForLatex($clientContact->toArray(true));
// Gets data from DB only
$clientAccount = new Account();
if ($clientAccount->retrieve($clientContact->account_id)) {
//$GLOBALS['log']->error('Account variables: variables transferred to latex template: '. var_export($clientAccount->toArray(true),true));
$contractData['clientContact']['account'] = sanatizeBeanArrayForLatex($clientAccount->toArray(true));
}
//gets data from DB only
}
// only date is needed (not time) and we have to convert it to the user format
global $timedate;
//$GLOBALS['log']->error('Contract variables: date_modified: '. var_export($contract->date_modified,true));
//$contractData['date_modified'] = $timedate->to_display_date($contract->date_modified);
$contractData['date_modified'] = $timedate->getDatePart($contract->date_modified);
//$contractData['startdate'] = $timedate->to_display_date($contract->startdate);
//$contractData['enddate'] = $timedate->to_display_date($contract->enddate);
//$contractData['deadline'] = $timedate->to_display_date($contract->deadline);
// translate
global $app_list_strings;
if (isset($contractData['periodofnotice'])) {
$contractData['periodofnotice'] = $app_list_strings['periodofnotice_list'][$contractData['periodofnotice']];
}
//contract currency setup
$currency = new Currency();
$currency_id = $currency->retrieve_id_by_name($contract->currency_id);
//$GLOBALS['log']->error('Contract variables: currency: '. var_export($currency_id,true));
if ($currency_id) {
$currency->retrieve($currency_id);
$contractData['currency_id'] = $currency->iso4217;
$contractData['currency_symbol'] = $currency->symbol;
} else {
$contractData['currency_id'] = $currency->getDefaultISO4217();
$contractData['currency_symbol'] = $currency->getDefaultCurrencySymbol();
}
$contractData['currency_symbol'] = str_replace("€", '\\euro{}', $contractData['currency_symbol']);
$contractData['currency_symbol'] = str_replace('$', '\\$', $contractData['currency_symbol']);
$contractData['currency_symbol'] = str_replace("£", '{\\pounds}', $contractData['currency_symbol']);
$contractData['currency_symbol'] = str_replace("¥", '{Y\\hspace*{-1.4ex}--}', $contractData['currency_symbol']);
// Get Sugar user information
$userData = oqc_getUserVariables();
$contractData = array_merge($contractData, $userData);
$outputData = array('contract' => $contractData, 'graphicsDir' => LATEX_GRAPHICS_DIR);
//$GLOBALS['log']->error('Contract variables: variables transferred to latex template: '. var_export($contractData,true));
return $outputData;
}
示例7: deleteByID
public static function deleteByID($userid){
$base = new Base();
//save everything in case we need to put them back in.
$contact = Contact::toArray(Contact::getByUserID($userid));
$auth = Authentication::toArray(Authentication::getByUserID($userid));
//get the user object
$user = User::getByID($userid);
//Delete user
$sql = "DELETE FROM users WHERE userid=?";
$values = array($userid);
$base->db->qwv($sql, $values);
if( $base->db->stat() ){
return $base->db->stat();
}
else{
foreach( $contact as $con ){
$con->contactid = null;
$con->save();
}
$auth->authenticationid = null;
$auth->save();
return false;
}
}