当前位置: 首页>>代码示例>>PHP>>正文


PHP DataObject::onAfterWrite方法代码示例

本文整理汇总了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();
     }
 }
开发者ID:sheadawson,项目名称:silverstripe-linkable,代码行数:30,代码来源:Link.php

示例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);
 }
开发者ID:quadra-digital,项目名称:silverstripe-mailchimp-module,代码行数:35,代码来源:MCListSegment.php

示例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);
     }
 }
开发者ID:normann,项目名称:advancedworkflow,代码行数:11,代码来源:WorkflowDefinition.php

示例4: onAfterWrite

 public function onAfterWrite()
 {
     parent::onAfterWrite();
     $dashboards = $this->Dashboards();
     if (!$dashboards->Count()) {
         $this->createDefaultBoards();
     }
 }
开发者ID:nyeholt,项目名称:silverstripe-frontend-dashboards,代码行数:8,代码来源:DashboardPage.php

示例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);
     }
 }
开发者ID:RyeDesigns,项目名称:silverstripe-forum,代码行数:12,代码来源:Post.php

示例6: onAfterWrite

 /**
  * Add an extension point for afterCreate
  */
 public function onAfterWrite()
 {
     parent::onAfterWrite();
     if ($this->_isCreating === true) {
         $this->_isCreating = false;
         $this->extend('onAfterCreate');
     }
 }
开发者ID:helpfulrobot,项目名称:betterbrief-silverstripe-opauth,代码行数:11,代码来源:OpauthIdentity.php

示例7: onAfterWrite

 protected function onAfterWrite()
 {
     parent::onAfterWrite();
     foreach ($this->EntitiesSurveys() as $sub_surveys) {
         $sub_surveys->IsTest = $this->IsTest;
         $sub_surveys->write();
     }
 }
开发者ID:hogepodge,项目名称:openstack-org,代码行数:8,代码来源:Survey.php

示例8: onAfterWrite

 protected function onAfterWrite()
 {
     parent::onAfterWrite();
     foreach ($this->EntitySurveys() as $entity) {
         $entity->Enabled = $this->Enabled;
         $entity->write();
     }
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:8,代码来源:SurveyTemplate.php

示例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();
 }
开发者ID:hamishcampbell,项目名称:silverstripe-url-shortener,代码行数:8,代码来源:SSURLShortenerObject.php

示例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);
     }
 }
开发者ID:firesphere,项目名称:silverstripe-newsmodule,代码行数:9,代码来源:SlideshowImage.php

示例12: onAfterWrite

 public function onAfterWrite()
 {
     parent::onAfterWrite();
     $Image = $this->Image();
     if ($Image) {
         $Image->Title = $this->Title;
         $Image->write();
     }
 }
开发者ID:helpfulrobot,项目名称:silvermax-maxphotos,代码行数:9,代码来源:MaxPhoto.php

示例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();
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:9,代码来源:Org.php

示例14: onAfterWrite

 public function onAfterWrite()
 {
     parent::onAfterWrite();
     self::updateProductCache();
     // Update the catalog cache
     if ($catalog = Catalog::get()->byID($this->CatalogID)) {
         $catalog->updateCatalogCache();
     }
 }
开发者ID:helpfulrobot,项目名称:flashbackzoo-silverstripe-angularjs-modeladmin,代码行数:9,代码来源:Product.php

示例15: onAfterWrite

 function onAfterWrite()
 {
     parent::onAfterWrite();
     $location = $this->getLocation($this->Address);
     if ($location) {
         $this->MapLatitude = $location['lat'];
         $this->MapLongitude = $location['lng'];
         $this->write();
     }
 }
开发者ID:helpfulrobot,项目名称:iqnection-pages-locationspage,代码行数:10,代码来源:LocationsPage.php


注:本文中的DataObject::onAfterWrite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。