public function objectChanged(BaseObject $object, array $modifiedColumns) { $tagsIdsToRemove = array(); $oldTags = $object->getColumnsOldValue(self::getClassConstValue(get_class($object->getPeer()), self::TAGS_FIELD_NAME)); if ($oldTags && $oldTags != "") { $tagsIdsToRemove = $this->checkExistForDelete($object, $oldTags); } $tagsToRemove = TagPeer::retrieveByPKs($tagsIdsToRemove); foreach ($tagsToRemove as $tagToRemove) { $tagToRemove->delete(); } $tagsToAdd = $this->checkExistsForAdd($object); $this->addTags($tagsToAdd, $this->getObjectIdByClassName(get_class($object)), $object->getPartnerId()); }
public function shouldConsumeChangedEvent(BaseObject $object, array $modifiedColumns) { if ($object instanceof entry && in_array(entryPeer::STATUS, $modifiedColumns) && ($object->getStatus() == entryStatus::READY || $object->getStatus() == entryStatus::ERROR_CONVERTING) && $object->getReplacedEntryId()) { return true; } if ($object instanceof UploadToken && in_array(UploadTokenPeer::STATUS, $modifiedColumns) && $object->getStatus() == UploadToken::UPLOAD_TOKEN_FULL_UPLOAD) { return true; } if ($object instanceof flavorAsset && in_array(assetPeer::STATUS, $modifiedColumns)) { return true; } if ($object instanceof BatchJob && $object->getJobType() == BatchJobType::BULKUPLOAD && $object->getStatus() == BatchJob::BATCHJOB_STATUS_ABORTED && in_array(BatchJobPeer::STATUS, $modifiedColumns) && in_array($object->getColumnsOldValue(BatchJobPeer::STATUS), BatchJobPeer::getClosedStatusList())) { return true; } if ($object instanceof UserRole && in_array(UserRolePeer::PERMISSION_NAMES, $modifiedColumns)) { return true; } if ($object instanceof FileSync && in_array(FileSyncPeer::STATUS, $modifiedColumns) && $object->getStatus() == FileSync::FILE_SYNC_STATUS_DELETED) { return true; } return false; }
public function objectChanged(BaseObject $object, array $modifiedColumns) { $privacyContexts = null; if ($object instanceof entry) { $criteria = new Criteria(); $criteria->add(categoryEntryPeer::ENTRY_ID, $object->getId()); $categoryEntries = categoryEntryPeer::doSelect($criteria); $privacyContexts = array(self::NULL_PC); if (count($categoryEntries)) { foreach ($categoryEntries as $categoryEntry) { /* @var $categoryEntry categoryEntry */ if ($categoryEntry->getPrivacyContext() != "") { $privacyContexts = array_merge($privacyContexts, self::trimObjectTags($categoryEntry->getPrivacyContext())); } else { $privacyContexts[] = kEntitlementUtils::DEFAULT_CONTEXT; } } $privacyContexts = array_unique($privacyContexts); } } $oldTags = $object->getColumnsOldValue(self::getClassConstValue(get_class($object->getPeer()), self::TAGS_FIELD_NAME)); $newTags = $object->getTags(); $tagsForDelete = implode(',', array_diff(explode(',', $oldTags), explode(',', $newTags))); $tagsForUpdate = implode(',', array_diff(explode(',', $newTags), explode(',', $oldTags))); if ($oldTags && $oldTags != "") { self::decrementExistingTagsInstanceCount($tagsForDelete, $object->getPartnerId(), get_class($object), $privacyContexts); } self::addOrIncrementTags($tagsForUpdate, $object->getPartnerId(), get_class($object), $privacyContexts); }