public static function loadObject($baseClass, $enumValue, array $constructorArgs = null) { if ($baseClass == 'ISyncableFile' && isset($constructorArgs['objectId'])) { $objectId = $constructorArgs['objectId']; if ($enumValue == self::getContentDistributionFileSyncObjectTypeCoreValue(ContentDistributionFileSyncObjectType::GENERIC_DISTRIBUTION_ACTION)) { GenericDistributionProviderActionPeer::setUseCriteriaFilter(false); $object = GenericDistributionProviderActionPeer::retrieveByPK($objectId); GenericDistributionProviderActionPeer::setUseCriteriaFilter(true); return $object; } if ($enumValue == self::getContentDistributionFileSyncObjectTypeCoreValue(ContentDistributionFileSyncObjectType::ENTRY_DISTRIBUTION)) { EntryDistributionPeer::setUseCriteriaFilter(false); $object = EntryDistributionPeer::retrieveByPK($objectId); EntryDistributionPeer::setUseCriteriaFilter(true); return $object; } if ($enumValue == self::getContentDistributionFileSyncObjectTypeCoreValue(ContentDistributionFileSyncObjectType::DISTRIBUTION_PROFILE)) { DistributionProfilePeer::setUseCriteriaFilter(false); $object = DistributionProfilePeer::retrieveByPK($objectId); DistributionProfilePeer::setUseCriteriaFilter(true); return $object; } } if ($baseClass == 'kJobData') { if ($enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT)) { return new kDistributionSubmitJobData(); } if ($enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE)) { return new kDistributionUpdateJobData(); } if ($enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DELETE)) { return new kDistributionDeleteJobData(); } if ($enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_FETCH_REPORT)) { return new kDistributionFetchReportJobData(); } if ($enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_ENABLE)) { return new kDistributionEnableJobData(); } if ($enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DISABLE)) { return new kDistributionDisableJobData(); } } if ($baseClass == 'KalturaJobData') { if ($enumValue == self::getApiValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT) || $enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_SUBMIT)) { return new KalturaDistributionSubmitJobData(); } if ($enumValue == self::getApiValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE) || $enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_UPDATE)) { return new KalturaDistributionUpdateJobData(); } if ($enumValue == self::getApiValue(ContentDistributionBatchJobType::DISTRIBUTION_DELETE) || $enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DELETE)) { return new KalturaDistributionDeleteJobData(); } if ($enumValue == self::getApiValue(ContentDistributionBatchJobType::DISTRIBUTION_FETCH_REPORT) || $enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_FETCH_REPORT)) { return new KalturaDistributionFetchReportJobData(); } if ($enumValue == self::getApiValue(ContentDistributionBatchJobType::DISTRIBUTION_ENABLE) || $enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_ENABLE)) { return new KalturaDistributionEnableJobData(); } if ($enumValue == self::getApiValue(ContentDistributionBatchJobType::DISTRIBUTION_DISABLE) || $enumValue == self::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DISABLE)) { return new KalturaDistributionDisableJobData(); } } return null; }
/** * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. * * This will only work if the object has been saved and has a valid primary key set. * * @param boolean $deep (optional) Whether to also de-associated any related objects. * @param PropelPDO $con (optional) The PropelPDO connection to use. * @return void * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db */ public function reload($deep = false, PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); } if ($this->isNew()) { throw new PropelException("Cannot reload an unsaved object."); } if ($con === null) { $con = Propel::getConnection(DistributionProfilePeer::DATABASE_NAME, Propel::CONNECTION_READ); } // We don't need to alter the object instance pool; we're just modifying this instance // already in the pool. DistributionProfilePeer::setUseCriteriaFilter(false); $stmt = DistributionProfilePeer::doSelectStmt($this->buildPkeyCriteria(), $con); DistributionProfilePeer::setUseCriteriaFilter(true); $row = $stmt->fetch(PDO::FETCH_NUM); $stmt->closeCursor(); if (!$row) { throw new PropelException('Cannot find matching row in the database to reload object values.'); } $this->hydrate($row, 0, true); // rehydrate if ($deep) { // also de-associate any related objects? } // if (deep) }
/** * Code to be run after inserting to database * @param PropelPDO $con */ public function postInsert(PropelPDO $con = null) { DistributionProfilePeer::setUseCriteriaFilter(false); $this->reload(); DistributionProfilePeer::setUseCriteriaFilter(true); kEventsManager::raiseEvent(new kObjectCreatedEvent($this)); if ($this->copiedFrom) { kEventsManager::raiseEvent(new kObjectCopiedEvent($this->copiedFrom, $this)); } }
public function getUpdateRequiredMetadataXPaths($distributionProfileId = null) { $ret = $this->getFromCustomData(self::CUSTOM_DATA_FIELD_UPDATE_REQUIRED_METADATA_XPATHS); if (!$ret) { $ret = array(); } if ($distributionProfileId) { DistributionProfilePeer::setUseCriteriaFilter(false); $distributionProfile = DistributionProfilePeer::retrieveByPK($distributionProfileId); DistributionProfilePeer::setUseCriteriaFilter(true); if ($distributionProfile && $distributionProfile instanceof GenericDistributionProfile) { $profileFields = $distributionProfile->getUpdateRequiredMetadataXPaths(); $ret = array_unique(array_merge($ret, $profileFields)); } } return $ret; }