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


PHP sfInflector::classify方法代码示例

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


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

示例1: arrayKeyCamelize

 /**
  * This method exists only for BC
  */
 public static function arrayKeyCamelize(array $array)
 {
     foreach ($array as $key => $value) {
         unset($array[$key]);
         $array[sfInflector::classify($key)] = $value;
     }
     return $array;
 }
开发者ID:phenom,项目名称:OpenPNE3,代码行数:11,代码来源:opFormItemGenerator.class.php

示例2: getAttachmentsByType

 public function getAttachmentsByType($type)
 {
     if (in_array($type, $this->_options['types'])) {
         return $this->getAttachmentsByTypeQuery($type)->execute();
     }
     $table = strtolower($type) == 'other' ? 'Attachment' : sfInflector::classify($type . '_attachment');
     return new Doctrine_Collection($table);
 }
开发者ID:bshaffer,项目名称:Symplist,代码行数:8,代码来源:Attachable.php

示例3: preExecute

 public function preExecute()
 {
     $this->getResponse()->setHttpHeader('Content-Type', 'application/atom+xml');
     $request = sfContext::getInstance()->getRequest();
     $model = $request->getParameter('model');
     $className = 'opAPI' . sfInflector::classify($model);
     $this->forward404Unless(class_exists($className));
     $params = $request->getParameterHolder()->getAll();
     $this->api = new $className($params, $this->getRoute());
     if ($this->getUser()->hasAttribute('member_id')) {
         $this->api->setMemberId($this->getUser()->getAttribute('member_id'));
     }
     $this->dispatcher->notify(new sfEvent($this, 'feeds_action.pre_execute'));
 }
开发者ID:kiwpon,项目名称:opWebAPIPlugin,代码行数:14,代码来源:actions.class.php

示例4: addField

 public function addField($space, $name, $options = array())
 {
     $type = isset($options['type']) ? strtolower($options['type']) : 'text';
     $class = sfInflector::classify($type) . 'ConfigField';
     if (class_exists($class)) {
         if (!isset($options['options']['label'])) {
             $options['options']['label'] = sfInflector::humanize($name);
         }
         $this->_fields[$space][$name] = new $class($options['options']);
         $this->widgetSchema[$space][$name] = $this->_fields[$space][$name]->getWidget();
         $this->validatorSchema[$space][$name] = $this->_fields[$space][$name]->getValidator();
     } else {
         throw new InvalidArgumentException('This field type doesn\'t, you need to create a classe named ' . $class);
     }
 }
开发者ID:benji07,项目名称:myConfigurationPlugin,代码行数:15,代码来源:myParamsForm.class.php

示例5: createTableNode

	/**
	 * Creates a table node
	 *
	 * @param      object $table The table
	 * @return     object The table node instance
	 */
	protected function createTableNode($table) {

		$this->log("Processing table: " . $table->toString());

		$node = $this->doc->createElement("table");
		$node->setAttribute("name", $table->getName());
    $tablePrefix = $this->getProject()->getProperty('propel.builder.tablePrefix');
		if ($this->isSamePhpName()) {
			$node->setAttribute("phpName", $table->getName());
		}
    elseif ($tablePrefix)
    {
      $prefix = '/^' . $tablePrefix . '/im';
      $tmp = sfInflector::classify(preg_replace($prefix, '', $table->getName()));
      $node->setAttribute("phpName", $tmp);
    }

		if ($vendorNode = $this->createVendorInfoNode($table->getVendorSpecificInfo())) {
			$node->appendChild($vendorNode);
		}

		// Create and add column nodes, register column validators
		$columns = $table->getColumns();
		foreach($columns as $column) {
			$columnNode = $this->createColumnNode($column);
			$node->appendChild($columnNode);
			$this->registerValidatorsForColumn($column);
			if ($column->isAutoIncrement()) {
				$idMethod = 'native';
			}
		}
		if (isset($idMethod)) {
			$node->setAttribute("idMethod", $idMethod);
		}

		// Create and add foreign key nodes.
		$foreignKeys = $table->getForeignKeys();
		foreach($foreignKeys as $foreignKey) {
			$foreignKeyNode = $this->createForeignKeyNode($foreignKey);
			$node->appendChild($foreignKeyNode);
		}

		// Create and add index nodes.
		$indices =  $table->getIndices();
		foreach($indices as $index) {
			$indexNode = $this->createIndexNode($index);
			$node->appendChild($indexNode);
		}

		// add an id-method-parameter if we have a sequence that matches table_colname_seq
		//
		//
		$pkey = $table->getPrimaryKey();
		if ($pkey) {
			$cols = $pkey->getColumns();
			if (count($cols) === 1) {
				$col = array_shift($cols);
				if ($col->isAutoIncrement()) {
					$seq_name = $table->getName().'_'.$col->getName().'_seq';
					if ($table->getDatabase()->isSequence($seq_name)) {
						$idMethodParameterNode = $this->doc->createElement("id-method-parameter");
						$idMethodParameterNode->setAttribute("value", $seq_name);
						$node->appendChild($idMethodParameterNode);
					}
				}
			}
		}


		// Create and add validator and rule nodes.
		$nodes = array();
		$tableName = $table->getName();
		if (isset($this->validatorInfos[$tableName])) {
			foreach ($this->validatorInfos[$tableName] as $colName => $rules) {
				$column = $table->getColumn($colName);
				$colName = $column->getName();
				foreach ($rules as $rule) {
					if (!isset($nodes[$colName])) {
						$nodes[$colName] = $this->createValidator($column, $rule['type']);
						$node->appendChild($nodes[$colName]);
					}
					$ruleNode = $this->createRuleNode($column, $rule);
					$nodes[$colName]->appendChild($ruleNode);
				}
			}
		}

		return $node;
	}
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:95,代码来源:PropelCreoleTransformTask.php

示例6: compilerFunctionUseSmartyHelper

 /**
  * Registers a smarty helper function
  *
  * @var array
  * @var Smarty_Internal_TemplateCompilerBase
  * @return string $phpcode
  */
 public function compilerFunctionUseSmartyHelper(array $args, Smarty_Internal_TemplateCompilerBase $compiler = null, $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler')
 {
     $compiler === null && ($compiler = new $compiler_class(null, null, $this->smarty));
     // PARSE THE ARGUMENTS
     eval('$helpers = ' . $args['helper'] . ';');
     if (!is_array($helpers)) {
         $helpers = explode(',', trim($helpers));
         $helpers = array_map('trim', $helpers);
     }
     $module_name = $this->getContext()->getModuleName();
     $helper_dirs = $this->getSmartyHelperDirs($module_name);
     $php = '';
     foreach ($helpers as $helper) {
         $helper_class_name = 'HelperSmarty' . sfInflector::classify($helper);
         $helper_class_filename = sfInflector::classify($helper) . '.class.php';
         foreach ($helper_dirs as $helper_dir) {
             $path_to_class = $helper_dir . '/' . $helper_class_filename;
             if (file_exists($path_to_class)) {
                 $php .= '<?php require_once(\'' . $path_to_class . '\');?>';
                 if (count($class_methods = get_class_methods($helper_class_name)) < 1) {
                     continue;
                 }
                 $class_methods = array_filter($class_methods, create_function('$helper', "return (strpos(\$helper, '_') !== 0) || strpos(\$helper, '__') === 0;"));
                 if (count($class_methods) < 1) {
                     continue;
                 }
                 // $php .= '<?php $___smarty_factory=sfSmartyFactory::getInstance();';
                 foreach ($class_methods as $class_method) {
                     // SMARTY MAGIC COMPILES THE TEMPLATE CORRECTLY ... IF THE CLASS
                     // EXISTS AT COMPILE TIME
                     $this->getSmarty()->register->templateFunction($class_method, array($helper_class_name, $class_method));
                     //$php .= '$___smarty_factory->registerSmartyHelperFunction(\'' . $class_method . '\', array(\'' . $helper_class_name . '\', \'' . $class_method . '\'), $_smarty_tpl->smarty);';
                 }
                 // $php .= '? >';
             }
         }
     }
     return $php;
 }
开发者ID:pycmam,项目名称:sfSmarty3Plugin,代码行数:46,代码来源:sfSmartyFactory.php

示例7: purge

 /**
  * Purge tasks.
  */
 protected function purge($task)
 {
     $method = 'purge' . sfInflector::classify(sfConfig::get('sf_orm'));
     return $this->{$method}($task);
 }
开发者ID:thunderwolf,项目名称:sf-task-logger-plugin,代码行数:8,代码来源:sfTaskLoggerPurgeRunningTask.class.php

示例8: countDayBatch

 /**
  * Check if a task with was already run today.
  */
 protected function countDayBatch($task)
 {
     $method = 'count' . sfInflector::classify(sfConfig::get('sf_orm')) . 'DayBatch';
     return $this->{$method}($task);
 }
开发者ID:thunderwolf,项目名称:sf-task-logger-plugin,代码行数:8,代码来源:sfBaseTaskLoggerTask.class.php

示例9: run_doctrine_load_nested_set

/**
 * run_doctrine_load_nested_set 
 * 
 * @param mixed $task 
 * @param mixed $args 
 * @access public
 * @return void
 */
function run_doctrine_load_nested_set($task, $args)
{
    if (!count($args)) {
        throw new Exception('You must provide the app.');
    }
    $app = $args[0];
    if (!is_dir(sfConfig::get('sf_app_dir') . DIRECTORY_SEPARATOR . $app)) {
        throw new Exception('The app "' . $app . '" does not exist.');
    }
    if (!isset($args[1])) {
        throw new Exception('You must provide a filename.');
    }
    $filename = $args[1];
    $env = empty($args[2]) ? 'dev' : $args[2];
    _load_application_environment($app, $env);
    $model = sfInflector::classify($args[1]);
    $ymlName = sfInflector::tableize($args[1]);
    $ymlPath = sfConfig::get('sf_data_dir') . '/' . $ymlName . '.yml';
    pake_echo_action('doctrine', 'loading nested set data for ' . $model);
    pake_echo_action('doctrine', 'loading ' . $ymlPath);
    $nestedSetData = sfYaml::load($ymlPath);
    _doctrine_load_nested_set_data($model, $nestedSetData);
}
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:31,代码来源:sfPakeDoctrine.php


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