コード例 #1
0
 public function postUpdate(PropelPDO $con = null)
 {
     if ($this->alreadyInSave) {
         return parent::postUpdate($con);
     }
     $objectUpdated = $this->isModified();
     $objectDeleted = false;
     if ($this->isColumnModified(kuserPeer::STATUS) && $this->getStatus() == KuserStatus::DELETED) {
         $objectDeleted = true;
     }
     $oldLoginDataId = null;
     if ($this->isColumnModified(kuserPeer::LOGIN_DATA_ID)) {
         $oldLoginDataId = $this->oldColumnsValues[kuserPeer::LOGIN_DATA_ID];
     }
     if ($this->isColumnModified(kuserPeer::EMAIL) && $this->getIsAccountOwner() && !is_null($this->oldColumnsValues[kuserPeer::EMAIL])) {
         myPartnerUtils::emailChangedEmail($this->getPartnerId(), $this->oldColumnsValues[kuserPeer::EMAIL], $this->getEmail(), $this->getPartner()->getName(), PartnerPeer::KALTURAS_PARTNER_EMAIL_CHANGE);
     }
     if ($this->getIsAccountOwner() && ($this->isColumnModified(kuserPeer::EMAIL) || $this->isColumnModified(kuserPeer::FIRST_NAME) || $this->isColumnModified(kuserPeer::LAST_NAME))) {
         $partner = $this->getPartner();
         $partner->setAccountOwnerKuserId($this->getId(), false);
         $partner->save();
     }
     $ret = parent::postUpdate($con);
     if ($objectDeleted) {
         kEventsManager::raiseEvent(new kObjectDeletedEvent($this));
         // if user is deleted - check if shoult also delete login data
         UserLoginDataPeer::notifyOneLessUser($this->getLoginDataId());
     }
     if ($objectUpdated) {
         kEventsManager::raiseEvent(new kObjectUpdatedEvent($this));
         if (!$objectDeleted && !is_null($oldLoginDataId) && is_null($this->getLoginDataId())) {
             // if login was disabled - check if should also delete login data
             UserLoginDataPeer::notifyOneLessUser($oldLoginDataId);
         }
     }
     return $ret;
 }
コード例 #2
0
ファイル: kuser.php プロジェクト: kubrickfr/server
 public function postUpdate(PropelPDO $con = null)
 {
     if ($this->alreadyInSave) {
         return parent::postUpdate($con);
     }
     $objectUpdated = $this->isModified();
     $objectDeleted = false;
     if ($this->isColumnModified(kuserPeer::STATUS) && $this->getStatus() == KuserStatus::DELETED) {
         $objectDeleted = true;
     }
     $oldLoginDataId = null;
     if ($this->isColumnModified(kuserPeer::LOGIN_DATA_ID)) {
         $oldLoginDataId = $this->oldColumnsValues[kuserPeer::LOGIN_DATA_ID];
     }
     if ($this->isColumnModified(kuserPeer::EMAIL) && $this->getIsAccountOwner() && isset($this->oldColumnsValues[kuserPeer::EMAIL]) && !is_null($this->oldColumnsValues[kuserPeer::EMAIL])) {
         myPartnerUtils::emailChangedEmail($this->getPartnerId(), $this->oldColumnsValues[kuserPeer::EMAIL], $this->getEmail(), $this->getPartner()->getName(), PartnerPeer::KALTURAS_PARTNER_EMAIL_CHANGE);
     }
     if ($this->getIsAccountOwner() && ($this->isColumnModified(kuserPeer::EMAIL) || $this->isColumnModified(kuserPeer::FIRST_NAME) || $this->isColumnModified(kuserPeer::LAST_NAME))) {
         $partner = $this->getPartner();
         $partner->setAccountOwnerKuserId($this->getId(), false);
         $partner->save();
     }
     if ($this->isColumnModified(kuserPeer::SCREEN_NAME) && categoryKuserPeer::isCategroyKuserExistsForKuser($this->getId())) {
         $featureStatusToRemoveIndex = new kFeatureStatus();
         $featureStatusToRemoveIndex->setType(IndexObjectType::CATEGORY_USER);
         $featureStatusesToRemove = array();
         $featureStatusesToRemove[] = $featureStatusToRemoveIndex;
         $filter = new categoryKuserFilter();
         $filter->setUserIdEqual($this->getPuserId());
         kJobsManager::addIndexJob($this->getPartnerId(), IndexObjectType::CATEGORY_USER, $filter, true, $featureStatusesToRemove);
     }
     $ret = parent::postUpdate($con);
     if ($objectDeleted) {
         kEventsManager::raiseEvent(new kObjectDeletedEvent($this));
         // if user is deleted - check if shoult also delete login data
         UserLoginDataPeer::notifyOneLessUser($this->getLoginDataId());
     }
     if ($objectUpdated) {
         kEventsManager::raiseEvent(new kObjectUpdatedEvent($this));
         if (!$objectDeleted && !is_null($oldLoginDataId) && is_null($this->getLoginDataId())) {
             // if login was disabled - check if should also delete login data
             UserLoginDataPeer::notifyOneLessUser($oldLoginDataId);
         }
     }
     return $ret;
 }