本文整理汇总了PHP中DataObject::onAfterWrite方法的典型用法代码示例。如果您正苦于以下问题:PHP DataObject::onAfterWrite方法的具体用法?PHP DataObject::onAfterWrite怎么用?PHP DataObject::onAfterWrite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObject
的用法示例。
在下文中一共展示了DataObject::onAfterWrite方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAfterWrite
/**
* If the title is empty, set it to getLinkURL()
*
* @return string
**/
public function onAfterWrite()
{
parent::onAfterWrite();
if (!$this->Title) {
switch ($this->Type) {
case 'URL':
case 'Email':
case 'Phone':
$this->Title = $this->{$this->Type};
break;
case 'SiteTree':
$this->Title = $this->SiteTree()->MenuTitle;
break;
default:
if ($this->Type && ($component = $this->getComponent($this->Type))) {
$this->Title = $component->Title;
}
break;
}
if (!$this->Title) {
$this->Title = 'Link-' . $this->ID;
}
$this->write();
}
}
示例2: onAfterWrite
public function onAfterWrite()
{
parent::onAfterWrite();
if ($this->isChanged("ID") && $this->getFirstWrite() && $this->getSyncMailChimp()) {
$apikey = SiteConfig::current_site_config()->getMCAPIKey();
$api = new MCAPI($apikey);
$list = $this->getComponent("MCList");
if (!empty($list)) {
// Limitited to 50 Bytes (Hopefully 50 Chars)
$SegmentTitle = substr($this->Title, 0, 45);
$api->listStaticSegmentAdd($list->ListID, $SegmentTitle);
if ($api->errorCode) {
SS_Log::log("API Call Failed: listStaticSegmentAdd(); | Error Code = " . $api->errorCode . " | Error Message = " . $api->errorMessage, SS_Log::ERR);
} else {
SS_Log::log("API Call Success: listStaticSegmentAdd();", SS_Log::NOTICE);
// Make Second Call To Return MailChimp Segment ID
$segments = $api->listStaticSegments($list->ListID);
foreach ($segments as $segment) {
// Make Sure We Capture the WHOLE Event ID!
$id_chars = strlen((string) $this->EventID);
$id = substr($segment['name'], 6, $id_chars);
if ($id == $this->EventID) {
SS_Log::log("This Event ID = " . $this->EventID . ", Static Segment Named " . $segment['name'] . " Relates to Event ID " . $id, SS_Log::NOTICE);
SS_Log::log("We Have a Match", SS_Log::NOTICE);
$this->setField("MCListSegmentID", $segment['id']);
$this->write();
break;
}
}
}
}
}
// END: if($this->isChanged("ID")) {
$this->setFirstWrite(false);
}
示例3: onAfterWrite
/**
* After we've been written, check whether we've got a template and to then
* create the relevant actions etc.
*/
public function onAfterWrite()
{
parent::onAfterWrite();
if ($this->numChildren() == 0 && $this->Template && !$this->TemplateVersion) {
$this->workflowService->defineFromTemplate($this, $this->Template);
}
}
示例4: onAfterWrite
public function onAfterWrite()
{
parent::onAfterWrite();
$dashboards = $this->Dashboards();
if (!$dashboards->Count()) {
$this->createDefaultBoards();
}
}
示例5: onAfterWrite
/**
* After saving this post, update the {@link ForumThread} with information
* that this is now the most recent post
*/
function onAfterWrite()
{
parent::onAfterWrite();
// Tell the thread this is the most recently added or edited.
if ($this->ThreadID) {
$this->Thread()->updateLastPost($this);
}
}
示例6: onAfterWrite
/**
* Add an extension point for afterCreate
*/
public function onAfterWrite()
{
parent::onAfterWrite();
if ($this->_isCreating === true) {
$this->_isCreating = false;
$this->extend('onAfterCreate');
}
}
示例7: onAfterWrite
protected function onAfterWrite()
{
parent::onAfterWrite();
foreach ($this->EntitiesSurveys() as $sub_surveys) {
$sub_surveys->IsTest = $this->IsTest;
$sub_surveys->write();
}
}
示例8: onAfterWrite
protected function onAfterWrite()
{
parent::onAfterWrite();
foreach ($this->EntitySurveys() as $entity) {
$entity->Enabled = $this->Enabled;
$entity->write();
}
}
示例9: onAfterWrite
public function onAfterWrite()
{
parent::onAfterWrite();
$pages = $this->Pages();
foreach ($pages as $page) {
$page->storeQuestionData();
}
}
开发者ID:helpfulrobot,项目名称:silverstripe-australia-silverstripe-question-answer,代码行数:8,代码来源:QuestionAnswerObject.php
示例10: onAfterWrite
function onAfterWrite()
{
if (!$this->Hash) {
$this->Hash = self::udihash($this->ID);
$this->write();
}
parent::onAfterWrite();
}
示例11: onAfterWrite
public function onAfterWrite()
{
parent::onAfterWrite();
/** @var SiteConfig $siteConfig Limit uploaded images to the setting in the siteconfig. */
$siteConfig = SiteConfig::current_site_config();
if ($siteConfig->SlideshowSize) {
$this->resizeImages($siteConfig);
}
}
示例12: onAfterWrite
public function onAfterWrite()
{
parent::onAfterWrite();
$Image = $this->Image();
if ($Image) {
$Image->Title = $this->Title;
$Image->write();
}
}
示例13: onAfterWrite
public function onAfterWrite()
{
parent::onAfterWrite();
//register new request
$new_request = new OrganizationRegistrationRequest();
$new_request->MemberID = Member::currentUserID();
$new_request->OrganizationID = $this->ID;
$new_request->write();
}
示例14: onAfterWrite
public function onAfterWrite()
{
parent::onAfterWrite();
self::updateProductCache();
// Update the catalog cache
if ($catalog = Catalog::get()->byID($this->CatalogID)) {
$catalog->updateCatalogCache();
}
}
示例15: onAfterWrite
function onAfterWrite()
{
parent::onAfterWrite();
$location = $this->getLocation($this->Address);
if ($location) {
$this->MapLatitude = $location['lat'];
$this->MapLongitude = $location['lng'];
$this->write();
}
}