本文整理汇总了PHP中Relationship::updateDateRange方法的典型用法代码示例。如果您正苦于以下问题:PHP Relationship::updateDateRange方法的具体用法?PHP Relationship::updateDateRange怎么用?PHP Relationship::updateDateRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Relationship
的用法示例。
在下文中一共展示了Relationship::updateDateRange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addLobbyFilingToRelationship
static function addLobbyFilingToRelationship(Relationship $relationship, LobbyFiling $filing)
{
$generatedAmount = self::getFecFilingAmountSumByRelationshipId($relationship->id) + $filing->amount;
$relationship->amount = max($generatedAmount, $relationship->amount);
$relationship->updateDateRange($filing->start_date);
$relationship->filings = $this->getLobbyFilingsByRelationshipId($relationship->id)->count() + 1;
$relationship->save();
$filing->relationship_id = $relationship->id;
$filing->save();
}
示例2: importFiling
//.........这里部分代码省略.........
$lobby_filing->federal_filing_id = $lda_filing->federal_filing_id;
$period = $lda_filing->LdaPeriod->description;
$lobby_filing->start_date = $date;
if ($paren = strpos($period, '(')) {
$lobby_filing->period = trim(substr($period, 0, $paren));
} else {
$lobby_filing->period = 'Undetermined';
}
$lobby_filing->report_type = LsLanguage::nameize($lda_filing->LdaType->description);
foreach ($issues as $issue) {
$filing_issue = new LobbyFilingLobbyIssue();
$filing_issue->Issue = $issue[0];
$filing_issue->Filing = $lobby_filing;
$filing_issue->specific_issue = $issue[1];
$filing_issue->save();
}
if (in_array('Lobbyist', $lobbying_entity_extensions)) {
$lobby_filing->Lobbyist[] = $lobbying_entity;
//$this->printDebug('Lobbying entity lobbyist added to lobbying relationship: ' . $lobbying_entity->name);
} else {
foreach ($lobbyists as $lobbyist) {
$lobby_filing->Lobbyist[] = $lobbyist;
}
}
//var_dump($lobby_filing->toArray());
$lobby_filing->save();
//CREATE TRANSACTION RELATIONSHIP, IF ANY
//$this->printTimeSince();
//$this->printDebug('starting transaction relationships:');
$transaction = null;
if ($client_entity != null) {
$transaction = RelationshipTable::getByCategoryQuery('Transaction')->addWhere('r.entity1_id = ?', $client_entity->id)->addWhere('r.entity2_id = ?', $lobbying_entity->id)->addWhere('transaction.is_lobbying = ?', 1)->fetchOne();
if ($transaction) {
$transaction->updateDateRange($date, true);
if ($lda_filing->amount && $lda_filing->amount != '') {
if (!$transaction->amount || $transaction->amount == '') {
$transaction->amount = $lda_filing->amount;
} else {
$transaction->amount += $lda_filing->amount;
}
}
$transaction->filings++;
$transaction->save();
$transaction->addReference(self::$filing_url . $lda_filing->federal_filing_id, $excerpt, $transaction->getAllModifiedFields(), 'LDA Filing', null, $date, false);
} else {
$transaction = new Relationship();
$transaction->Entity1 = $client_entity;
$transaction->Entity2 = $lobbying_entity;
$transaction->setCategory('Transaction');
$transaction->description1 = 'Lobbying Client';
$transaction->is_lobbying = 1;
$transaction->filings = 1;
$transaction->updateDateRange($date, true);
if (in_array('Person', $lobbying_entity_extensions)) {
$transaction->description2 = 'Hired Lobbyist';
} else {
$transaction->description2 = 'Lobbying Firm';
}
if ($lda_filing->amount && $lda_filing->amount != '') {
$transaction->amount = $lda_filing->amount;
}
$transaction->save();
$transaction->addReference(self::$filing_url . $lda_filing->federal_filing_id, $excerpt, $transaction->getAllModifiedFields(), 'LDA Filing', null, $date, false);
//$this->printDebug('New lobbying transaction saved between client ' . $client_entity->name . ' and lobbying firm ' . $lobbying_entity->name);
}
$relationships[] = $transaction;