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


PHP kPluginableEnumsManager::genericApiToCore方法代码示例

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


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

示例1: handleFile

function handleFile($filePath)
{
    $con = Propel::getConnection(PartnerPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    $fileName = basename($filePath);
    KalturaLog::info("Handling file [{$fileName}]");
    list($order, $objectType, $fileExtension) = explode('.', $fileName, 3);
    $objectConfigurations = parse_ini_file($filePath, true);
    $object = new $objectType();
    /* @var $object BaseObject */
    $peer = $object->getPeer();
    $peerClass = get_class($peer);
    $newObjectType = "Insert{$objectType}";
    if (!class_exists($newObjectType)) {
        eval('
			class Insert' . $objectType . ' extends ' . $objectType . '
			{
				public function setId($v)
				{
					if(!$this->getId())
						parent::setId($v);
					
					return $this;
				}
				
				protected function doSave(PropelPDO $con)
				{
					$affectedRows = 0; // initialize var to track total num of affected rows
					if (!$this->alreadyInSave) {
						$this->alreadyInSave = true;
			
						$this->objectSaved = false;
						if ($this->isModified()) {
							if ($this->isNew()) {
								$pk = BasePeer::doInsert($this->buildCriteria(), $con);
								$affectedRows += 1;
								$this->setId($pk);  //[IMV] update autoincrement primary key
								$this->setNew(false);
								$this->objectSaved = true;
							} else {
								$affectedObjects = ' . $peerClass . '::doUpdate($this, $con);
								if($affectedObjects)
									$this->objectSaved = true;
									
								$affectedRows += $affectedObjects;
							}
			
							$this->resetModified(); // [HL] After being saved an object is no longer \'modified\'
						}
			
						$this->alreadyInSave = false;
					}
					return $affectedRows;
				}
			}
		');
    }
    $map = $peer->getTableMap();
    $primaryKeys = $map->getPrimaryKeys();
    foreach ($objectConfigurations as $objectConfiguration) {
        $object = new $newObjectType();
        /* @var $object BaseObject */
        $pk = null;
        $pkField = null;
        // New logic allowing to use other parameters as uique identifers for updates
        $identifierParam = null;
        $identifierColumn = null;
        $setters = array();
        foreach ($objectConfiguration as $attributeName => $value) {
            if ($attributeName == 'id') {
                $pk = $value;
            } elseif ($attributeName == 'identifierParam') {
                ${$attributeName} = $value;
                continue;
            }
            if (preg_match('/eval\\((?P<evalString>.+)\\)/', $value, $matches)) {
                $evalString = $matches["evalString"];
                $evaluator = new kEvalStringField();
                $evaluator->setScope(new kScope());
                $evaluator->setCode($evalString);
                $value = $evaluator->getValue();
                KalturaLog::info("Evaluated property value: {$value}");
            }
            $setter = "set{$attributeName}";
            if (!is_callable(array($object, $setter))) {
                throw new Exception("Attribute [{$attributeName}] not defined on object type [{$objectType}]");
            }
            if (preg_match('/^@[^@]+$/', $value)) {
                $valueFilePath = realpath(dirname($filePath) . '/' . substr($value, 1));
                if (!$valueFilePath || !is_file($valueFilePath)) {
                    throw new Exception("Attribute [{$attributeName}] file path [{$value}] not found");
                }
                $value = file_get_contents($valueFilePath);
            }
            if (preg_match('/^#[^#]+$/', $value)) {
                $value = kPluginableEnumsManager::genericApiToCore(substr($value, 1));
            }
            $setters[$setter] = $value;
        }
        $pkCriteria = null;
        $existingObject = null;
//.........这里部分代码省略.........
开发者ID:GElkayam,项目名称:server,代码行数:101,代码来源:insertDefaults.php


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