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


PHP BaseObject::getPeer方法代码示例

本文整理汇总了PHP中BaseObject::getPeer方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseObject::getPeer方法的具体用法?PHP BaseObject::getPeer怎么用?PHP BaseObject::getPeer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseObject的用法示例。


在下文中一共展示了BaseObject::getPeer方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setRelatedObject

 /**
  * @param BaseObject $object
  */
 protected function setRelatedObject(AuditTrail $auditTrail, BaseObject $object)
 {
     if (class_exists('Metadata') && $object instanceof Metadata) {
         $auditTrail->setRelatedObjectType(AuditTrailObjectType::METADATA_PROFILE);
         $auditTrail->setRelatedObjectId($object->getMetadataProfileId());
     }
     if ($auditTrail->getAction() == AuditTrail::AUDIT_TRAIL_ACTION_FILE_SYNC_CREATED) {
         $peer = $object->getPeer();
         $objectType = $peer->getOMClass(false, null);
         $auditTrail->setRelatedObjectType($objectType);
         $auditTrail->setRelatedObjectId($object->getId());
     }
     if ($object instanceof FileSync) {
         switch ($object->getObjectType()) {
             case FileSyncObjectType::ENTRY:
                 $auditTrail->setRelatedObjectType(AuditTrailObjectType::ENTRY);
                 $auditTrail->setRelatedObjectId($object->getObjectId());
                 $auditTrail->setEntryId($object->getObjectId());
                 break;
             case FileSyncObjectType::UICONF:
                 $auditTrail->setRelatedObjectType(AuditTrailObjectType::UI_CONF);
                 $auditTrail->setRelatedObjectId($object->getObjectId());
                 break;
             case FileSyncObjectType::BATCHJOB:
                 $auditTrail->setRelatedObjectType(AuditTrailObjectType::BATCH_JOB);
                 $auditTrail->setRelatedObjectId($object->getObjectId());
                 $batchJob = BatchJobPeer::retrieveByPK($object->getObjectId());
                 if ($batchJob) {
                     $auditTrail->setEntryId($batchJob->getEntryId());
                 }
                 break;
             case FileSyncObjectType::FLAVOR_ASSET:
                 $auditTrail->setRelatedObjectType(AuditTrailObjectType::FLAVOR_ASSET);
                 $auditTrail->setRelatedObjectId($object->getObjectId());
                 $flavorAsset = flavorAssetPeer::retrieveById($object->getObjectId());
                 if ($flavorAsset) {
                     $auditTrail->setEntryId($flavorAsset->getEntryId());
                 }
                 break;
             case FileSyncObjectType::METADATA:
                 $auditTrail->setRelatedObjectType(AuditTrailObjectType::METADATA);
                 $auditTrail->setRelatedObjectId($object->getObjectId());
                 if (class_exists('Metadata')) {
                     $metadata = MetadataPeer::retrieveByPK($object->getObjectId());
                     if ($metadata && $metadata->getObjectType() == Metadata::TYPE_ENTRY) {
                         $auditTrail->setEntryId($metadata->getObjectId());
                     }
                 }
                 break;
             case FileSyncObjectType::METADATA_PROFILE:
                 $auditTrail->setRelatedObjectType(AuditTrailObjectType::METADATA_PROFILE);
                 $auditTrail->setRelatedObjectId($object->getObjectId());
                 break;
         }
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:59,代码来源:kAuditTrailManager.php

示例2: setByArray

 public static function setByArray(BaseObject $model, $values)
 {
     $peer = $model->getPeer();
     $columns = array_flip($peer::getFieldNames(BasePeer::TYPE_FIELDNAME));
     foreach ($values as $name => $value) {
         if (isset($columns[$name])) {
             $phpName = $peer::translateFieldName($name, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_PHPNAME);
             $method = 'set' . $phpName;
             if ($value === '') {
                 $value = null;
             }
             $model->{$method}($value);
         }
     }
 }
开发者ID:dafik,项目名称:dfi,代码行数:15,代码来源:ModelValues.php

示例3: comparePropelObjectsByFields

 /**
  * 
  * Compares two propel objects and notifies the PHPUnit / Kaltura's listeners
  * @param BaseObject $outputReference
  * @param BaseObject $newResult
  * @return array<> $newErrors, if the objects are equal
  */
 public function comparePropelObjectsByFields($outputReference, $newResult, $validErrorFields)
 {
     //Gets the data peer of the object (used to geting all the obejct feilds)
     $dataPeer = $outputReference->getPeer();
     $outputReferenceId = $outputReference->getId();
     $newResultId = $newResult->getId();
     //Gets all object feilds
     $fields = call_user_func(array($dataPeer, "getFieldNames"), BasePeer::TYPE_PHPNAME);
     $newErrors = array();
     //Create the xml elements by all fields and their values
     foreach ($fields as $field) {
         PHP_Timer::start();
         //If the field is in the valid failure list then we skip him
         if (in_array($field, $validErrorFields)) {
             continue;
         } else {
             $expectedValue = $outputReference->getByName($field);
             $actualValue = $newResult->getByName($field);
             //if this is an array we need to change it to a string
             $this->compareOnField($field, $actualValue, $expectedValue, "assertEquals");
         }
     }
     return $newErrors;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:31,代码来源:KalturaServerTestCase.php

示例4: checkExistForDelete

 /**
  * Function which checks the object tags agains DB
  * and returns an array of tags ids which need to be deleted.
  * @param BaseObject $object
  * @return array
  */
 protected function checkExistForDelete(BaseObject $object, $tagsToCheck = null)
 {
     $objectTags = $tagsToCheck ? $this->trimObjectTags($tagsToCheck) : $this->trimObjectTags($object->getTags());
     $objectTags = str_replace(self::$specialCharacters, self::$specialCharactersReplacement, $objectTags);
     $tagsToKeep = array();
     foreach ($objectTags as $objectTag) {
         $peer = $object->getPeer();
         $c = KalturaCriteria::create(get_class($object));
         $c->addAnd(self::PARTNER_ID_FIELD, $object->getPartnerId(), KalturaCriteria::EQUAL);
         $c->addAnd($peer::TAGS, $objectTag, KalturaCriteria::LIKE);
         $c->addAnd($peer::ID, array($object->getId()), KalturaCriteria::NOT_IN);
         $selectResults = $peer->doSelect($c);
         foreach ($selectResults as $selectResult) {
             $resultTags = $this->trimObjectTags($selectResult->getTags());
             if (in_array($objectTag, $resultTags)) {
                 //    	            if(isset($tagsToKeep[$objectTag]))
                 //    	                $tagsToKeep[$objectTag]++;
                 //    	            else
                 //    	                $tagsToKeep[$objectTag] = 1;
                 if (!in_array($objectTag, $tagsToKeep)) {
                     $tagsToKeep[] = $objectTag;
                 }
             }
         }
     }
     KalturaLog::debug("tags to keep: " . print_r($tagsToKeep, true));
     if (count($tagsToKeep)) {
         //Decrement instance count for the tags that we keep
         $c = self::getTagObjectsByTagStringsCriteria($tagsToKeep, $this->getObjectIdByClassName(get_class($object)), $object->getPartnerId());
         $tagsToKeepObjects = TagPeer::doSelect($c);
         foreach ($tagsToKeepObjects as $tagToKeepObject) {
             /* @var $tagToKeepObject Tag */
             $tagToKeepObject->decrementInstanceCount();
         }
     }
     //Return the IDs of the rest of the tags for removal.
     $tagsToRemove = array_diff($objectTags, $tagsToKeep);
     KalturaLog::debug("tags to delete: " . print_r($tagsToRemove, true));
     if ($tagsToRemove) {
         $c = self::getTagObjectsByTagStringsCriteria($tagsToRemove, $this->getObjectIdByClassName(get_class($object)), $object->getPartnerId());
         $c->applyFilters();
         $recordsToRemove = $c->getRecordsCount();
         return $c->getFetchedIds();
     }
     return array();
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:52,代码来源:kTagFlowManager.php

示例5: getUpdateTreeQueries

 /**
  * Returns queries needed to update tree.
  * 
  * @param     BaseObject    $node
  * @param     integer       $dest_left
  * 
  * @return array
  */
 private static function getUpdateTreeQueries(BaseObject $node, $dest_left)
 {
     $statements = array();
     $peer_name = get_class($node->getPeer());
     $left = $node->getLeftValue();
     $right = $node->getRightValue();
     $tree_size = $right - $left + 1;
     $statements = array_merge($statements, self::shiftRLValues($peer_name, $dest_left, $tree_size, $node->getScopeIdValue()));
     if ($left >= $dest_left) {
         $left += $tree_size;
         $right += $tree_size;
     }
     $statements = array_merge($statements, self::shiftRLRange($peer_name, $left, $right, $dest_left - $left, $node->getScopeIdValue()));
     $statements = array_merge($statements, self::shiftRLValues($peer_name, $right + 1, -$tree_size, $node->getScopeIdValue()));
     return $statements;
 }
开发者ID:net7,项目名称:Talia-CMS,代码行数:24,代码来源:sfPropelActAsNestedSetBehavior.class.php

示例6: processFileFields

 /**
  * File fields processing
  *
  * @example <i:field label="File" name="file" type="file">
  *              <i:value type="orm">
  *                  <i:class>ModelCriteriaFetcher</i:class>
  *                  <i:method name="configureFileField">
  *                      <i:param name="fields">[path:file_path_field]</i:param>
  *                  </i:method>
  *              </i:value>
  *          </i:field>
  *          
  *          if multiple files for table should be added <i:param name="glue_model">ForeignModelName</i:param>
  *          
  * @param BaseObject $model 
  * @return void
  * @author Sergey Startsev
  */
 public function processFileFields(BaseObject $model)
 {
     $model_name = $this->object->getPeer()->getOMClass(false);
     $upload_dir = sfConfig::get('sf_upload_dir');
     $web_upload_dir = str_replace(sfConfig::get('sf_web_dir'), '', $upload_dir);
     if (!file_exists($upload_dir)) {
         mkdir($upload_dir);
     }
     foreach ($this->dom_xml_xpath->query('//i:fields/i:field[@type="file"]') as $field) {
         $name = $field->getAttribute('name');
         $params = array();
         $class = $field->getElementsByTagName('class');
         $method = $field->getElementsByTagName('method');
         if (!$class || !$method) {
             continue;
         }
         $classNode = $class->item(0);
         $methodNode = $method->item(0);
         if ($classNode->nodeValue != 'ModelCriteriaFetcher' || $methodNode->getAttribute('name') != 'configureFileField') {
             continue;
         }
         foreach ($methodNode->getElementsByTagName('param') as $param) {
             $params[$param->getAttribute('name')] = $param->nodeValue;
         }
         $is_foreign = false;
         $hashes = array();
         if (!array_key_exists('fields', $params)) {
             continue;
         }
         foreach (explode(',', str_replace(array('[', ']'), '', $params['fields'])) as $def) {
             list($key, $value) = explode(':', $def);
             $hashes[$key] = $value;
         }
         if (array_key_exists('glue_model', $params)) {
             $glue_model = $params['glue_model'];
             $is_foreign = true;
         }
         if (array_key_exists('upload_dir', $params)) {
             $web_upload_dir = '/' . trim($params['upload_dir'], '/');
             $upload_dir = sfConfig::get('sf_web_dir') . $web_upload_dir;
             if (!file_exists($upload_dir)) {
                 @mkdir($upload_dir, 0775, true);
             }
         }
         if (!isset($_FILES['edit']['name']['0'][$name]) || !$_FILES['edit']['size']['0'][$name]) {
             continue;
         }
         $file_native_name = $_FILES['edit']['name']['0'][$name];
         $file_size = $_FILES['edit']['size']['0'][$name];
         $file_name = Util::makeRandomKey() . '.' . pathinfo($file_native_name, PATHINFO_EXTENSION);
         $file_path = "{$upload_dir}/{$file_name}";
         $tmp_name = $_FILES['edit']['tmp_name']['0'][$name];
         if (!move_uploaded_file($tmp_name, $file_path)) {
             continue;
         }
         if ($is_foreign) {
             $glue = new $glue_model();
             call_user_func(array($glue, "set" . get_class($model)), $model);
         } else {
             $glue = $model;
         }
         if (array_key_exists('path', $hashes)) {
             $glue->setByName($hashes['path'], "{$web_upload_dir}/{$file_name}", BasePeer::TYPE_FIELDNAME);
         }
         if (array_key_exists('original_name', $hashes)) {
             $glue->setByName($hashes['original_name'], $file_native_name, BasePeer::TYPE_FIELDNAME);
         }
         if (array_key_exists('name', $hashes)) {
             $glue->setByName($hashes['name'], $file_name, BasePeer::TYPE_FIELDNAME);
         }
         if (array_key_exists('size', $hashes)) {
             $glue->setByName($hashes['size'], $file_size, BasePeer::TYPE_FIELDNAME);
         }
         $glue->save();
     }
 }
开发者ID:cbsistem,项目名称:appflower_engine,代码行数:94,代码来源:simpleWidgetEditAction.class.php

示例7: relatedTo

 /**
  * Finder fluid method to restrict results to a related object
  * Examples:
  *   $commentFinder->relatedTo($article)
  *    => $c->add(CommentPeer::ARTICLE_ID, $article->getId())
  *
  * @param  BaseObject $object The related object to restrict to
  * @return sfPropelFinder the current finder object
  */
 public function relatedTo($object)
 {
     // looking for a 1-n relationship
     $relatedObjectTableName = $object->getPeer()->getTableMap()->getName();
     foreach (sfPropelFinderUtils::getColumnsForPeerClass($this->peerClass) as $c) {
         if ($c->getRelatedTableName() == $relatedObjectTableName) {
             $this->addCondition('and', $c->getFullyQualifiedName(), $object->getByName($c->getRelatedName(), BasePeer::TYPE_COLNAME), Criteria::EQUAL);
             return $this;
         }
     }
     // looking for a n-1 relationship
     $localObjectTableName = $this->object->getPeer()->getTableMap()->getName();
     foreach (sfPropelFinderUtils::getColumnsForPeerClass(get_class($object->getPeer())) as $c) {
         if ($c->getRelatedTableName() == $localObjectTableName) {
             $this->addCondition('and', $c->getRelatedName(), $object->getByName($c->getFullyQualifiedName(), BasePeer::TYPE_COLNAME), Criteria::EQUAL);
             return $this;
         }
     }
     throw new Exception('Could not find a relation with object of class ' . get_class($object));
 }
开发者ID:Zadkiel,项目名称:zadkiel_blog,代码行数:29,代码来源:sfPropelFinder.php

示例8: addBulkUploadResultDescription

 /**
  * Add description of an error to the BulkUploadResult of the object in question
  * @param BaseObject $object
  * @param string $bulkUploadId
  * @param string $description
  */
 protected static function addBulkUploadResultDescription(BaseObject $object, $bulkUploadId, $description)
 {
     $objectPeerClass = get_class($object->getPeer());
     $objectType = strtoupper(constant("{$objectPeerClass}::OM_CLASS"));
     if ($objectType == 'KUSER') {
         $objectType = 'USER';
     }
     $bulkUploadResult = BulkUploadResultPeer::retrieveByObjectId($object->getId(), constant("BulkUploadObjectType::{$objectType}"), $bulkUploadId);
     if (!$bulkUploadResult) {
         KalturaLog::err("Bulk upload results not found for object [{$object->getId()}]");
         return;
     }
     $msg = $bulkUploadResult->getErrorDescription();
     if ($msg) {
         $msg .= "\n";
     }
     $msg .= $description;
     $bulkUploadResult->setErrorDescription($msg);
     $bulkUploadResult->save();
 }
开发者ID:kubrickfr,项目名称:server,代码行数:26,代码来源:MetadataPlugin.php

示例9: forgeMethodName

 /**
  * Returns getter / setter name for requested column.
  * 
  * @param     BaseObject    $resource
  * @param     string        $prefix     Usually 'get' or 'set'
  * @param     string        $column     uuid|version
  */
 private static function forgeMethodName($resource, $prefix, $column)
 {
     $method_name = sprintf('%s%s', $prefix, $resource->getPeer()->translateFieldName(self::getColumnConstant(get_class($resource), $column), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME));
     return $method_name;
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:12,代码来源:sfPropelUuidBehavior.class.php

示例10: objectChanged

 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);
 }
开发者ID:DBezemer,项目名称:server,代码行数:29,代码来源:kTagFlowManager.php

示例11: setObject

 /**
  * @param BaseObject $object
  */
 public function setObject(BaseObject $object)
 {
     $this->peer = get_class($object->getPeer());
     $this->primaryKey = $object->getPrimaryKey();
 }
开发者ID:DBezemer,项目名称:server,代码行数:8,代码来源:kBusinessProcessNotificationDispatchJobData.php


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