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


PHP Doctrine_Lib类代码示例

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


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

示例1: __construct

 public function __construct(array $options = array())
 {
     $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
     if (!$this->_options['onlyOwnable']) {
         $this->_plugin = new Doctrine_Guardable($this->_options);
     }
 }
开发者ID:everzet,项目名称:sfDoctrineObjectGuardPlugin,代码行数:7,代码来源:Guardable.php

示例2: __construct

 /**
  * Constructor for Locatable Template
  *
  * @param array $options
  *
  * @return void
  */
 public function __construct(array $options = array())
 {
     $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
     if (!$this->_options['fields']) {
         throw new sfException('The Geolocatable Behavior requires the "fields" option to be set in your schema');
     }
 }
开发者ID:jwegner,项目名称:csDoctrineActAsGeolocatablePlugin,代码行数:14,代码来源:Geolocatable.php

示例3: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $config = $this->getCliConfig();
     $pluginSchemaDirectories = glob(sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'doctrine');
     $pluginSchemas = sfFinder::type('file')->name('*.yml')->in($pluginSchemaDirectories);
     $tmpPath = sfConfig::get('sf_cache_dir') . DIRECTORY_SEPARATOR . 'tmp';
     if (!file_exists($tmpPath)) {
         Doctrine_Lib::makeDirectories($tmpPath);
     }
     foreach ($pluginSchemas as $schema) {
         $schema = str_replace('/', DIRECTORY_SEPARATOR, $schema);
         $plugin = str_replace(sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR, '', $schema);
         $e = explode(DIRECTORY_SEPARATOR, $plugin);
         $plugin = $e[0];
         $name = basename($schema);
         $tmpSchemaPath = $tmpPath . DIRECTORY_SEPARATOR . $plugin . '-' . $name;
         $models = Doctrine_Parser::load($schema, 'yml');
         if (!isset($models['package'])) {
             $models['package'] = $plugin . '.lib.model.doctrine';
         }
         Doctrine_Parser::dump($models, 'yml', $tmpSchemaPath);
     }
     $import = new Doctrine_Import_Schema();
     $import->setOption('generateBaseClasses', true);
     $import->setOption('generateTableClasses', true);
     $import->setOption('packagesPath', sfConfig::get('sf_plugins_dir'));
     $import->setOption('packagesPrefix', 'Plugin');
     $import->setOption('suffix', '.class.php');
     $import->setOption('baseClassesDirectory', 'generated');
     $import->setOption('baseClassName', 'sfDoctrineRecord');
     $import->importSchema(array($tmpPath, $config['yaml_schema_path']), 'yml', $config['models_path']);
     $this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('doctrine', 'Generated models successfully'))));
 }
开发者ID:silky,项目名称:littlesis,代码行数:36,代码来源:sfDoctrineBuildModelTask.class.php

示例4: __construct

 /**
  * __construct
  *
  * @param string $options 
  * @return void
  */
 public function __construct(array $options = array())
 {
     $dispatcher = ProjectConfiguration::getActive()->getEventDispatcher();
     $dispatcher->connect('commentable.add_commentable_class', array($this, 'getCommentables'));
     $options['generatePath'] = sfConfig::get('sf_lib_dir') . '/model/doctrine/sfCommentsPlugin';
     $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
 }
开发者ID:bshaffer,项目名称:Symplist,代码行数:13,代码来源:CommentLinkGenerator.class.php

示例5: setUp

 /**
  * Initialize the template
  * @return void
  */
 public function setUp()
 {
     // TODO: cache compiled options since they do not change frequently
     $options = $this->options;
     // merge in special soft delete options
     if ($this->getInvoker()->getTable()->hasTemplate('SoftDelete')) {
         $options = Doctrine_Lib::arrayDeepMerge($options, $this->optionsWhenSoftDeleteIsEnabled);
     }
     // merge in options defined in the schema
     $options = Doctrine_Lib::arrayDeepMerge($options, $this->_options);
     // merge in default options for credentials
     foreach ($options['credentials'] as $credential => $cOptions) {
         $options['credentials'][$credential] = array_merge($this->credentialOptions, $cOptions);
     }
     // merge in default options for fields
     foreach ($options['fields'] as $fieldName => $fieldOptions) {
         $fieldOptions = array_merge($this->fieldOptions, $fieldOptions);
         if (!is_string($fieldOptions['view']) && !is_null($fieldOptions['view']) && $fieldOptions['view'] !== false) {
             throw new InvalidArgumentException(sprintf('view credential has an invalid type for field %s.', $fieldName));
         }
         if (!is_string($fieldOptions['edit']) && !is_null($fieldOptions['edit']) && $fieldOptions['edit'] !== false) {
             throw new InvalidArgumentException(sprintf('edit credential has an invalid type for field %s.', $fieldName));
         }
         if (!is_string($fieldOptions['create']) && !is_null($fieldOptions['create']) && $fieldOptions['create'] !== false) {
             throw new InvalidArgumentException(sprintf('create credential has an invalid type for field %s.', $fieldName));
         }
         $options['fields'][$fieldName] = $fieldOptions;
     }
     $options['credentials'] = $this->copyRelationsToEachSide($options['credentials']);
     $this->options = $options;
 }
开发者ID:schmittjoh,项目名称:jmsDoctrinePlugin,代码行数:35,代码来源:Credentialable.class.php

示例6: __construct

 public function __construct(array $options = array())
 {
     $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
     if (!isset($this->_options['connection'])) {
         $this->_options['connection'] = Doctrine_Manager::connection();
     }
 }
开发者ID:pierswarmers,项目名称:rtCorePlugin,代码行数:7,代码来源:rtCommentTemplate.class.php

示例7: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $this->logSection('doctrine', 'generating model classes');
     $config = $this->getCliConfig();
     $this->_checkForPackageParameter($config['yaml_schema_path']);
     $tmpPath = sfConfig::get('sf_cache_dir') . DIRECTORY_SEPARATOR . 'tmp';
     if (!file_exists($tmpPath)) {
         Doctrine_Lib::makeDirectories($tmpPath);
     }
     $plugins = $this->configuration->getPlugins();
     foreach ($this->configuration->getAllPluginPaths() as $plugin => $path) {
         if (!in_array($plugin, $plugins)) {
             continue;
         }
         $schemas = sfFinder::type('file')->name('*.yml')->in($path . '/config/doctrine');
         foreach ($schemas as $schema) {
             $tmpSchemaPath = $tmpPath . DIRECTORY_SEPARATOR . $plugin . '-' . basename($schema);
             $models = Doctrine_Parser::load($schema, 'yml');
             if (!isset($models['package'])) {
                 $models['package'] = $plugin . '.lib.model.doctrine';
                 $models['package_custom_path'] = $path . '/lib/model/doctrine';
             }
             Doctrine_Parser::dump($models, 'yml', $tmpSchemaPath);
         }
     }
     $options = array('generateBaseClasses' => true, 'generateTableClasses' => true, 'packagesPath' => sfConfig::get('sf_plugins_dir'), 'packagesPrefix' => 'Plugin', 'suffix' => '.class.php', 'baseClassesDirectory' => 'base', 'baseClassName' => 'sfDoctrineRecord');
     $options = array_merge($options, sfConfig::get('doctrine_model_builder_options', array()));
     $import = new Doctrine_Import_Schema();
     $import->setOptions($options);
     $import->importSchema(array($tmpPath, $config['yaml_schema_path']), 'yml', $config['models_path']);
 }
开发者ID:yasirgit,项目名称:afids,代码行数:34,代码来源:sfDoctrineBuildModelTask.class.php

示例8: setOption

 /** 
  * setOption 
  * sets an option in order to allow flexible listener chaining 
  * 
  * @param mixed $name              the name of the option to set 
  * @param mixed $value              the value of the option 
  */
 public function setOption($name, $value = null)
 {
     if (is_array($name)) {
         $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $name);
     } else {
         $this->_options[$name] = $value;
     }
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:15,代码来源:Chain.php

示例9: fill

 public function fill($name, $values = array())
 {
     $formValues = Doctrine_Lib::arrayDeepMerge($this->getFormValues($name), $values);
     foreach ($formValues as $key => $value) {
         $this->setDefaultField($key, $value);
     }
     return $this->getObjectToReturn();
 }
开发者ID:bshaffer,项目名称:Symfony-Snippets,代码行数:8,代码来源:csTesterForm.class.php

示例10: __construct

 /**
  * __construct
  *
  * @param string $array
  * @return null
  */
 public function __construct(array $options = array())
 {
     $this->_options = Doctrine_Lib::arrayDeepMerge($this->getOptions(), $options);
     $this->invokerNamespace = sprintf('%s/%s', __CLASS__, sfCacheTaggingToolkit::generateVersion());
     $versionColumn = $this->getOption('versionColumn');
     if (!is_string($versionColumn) || 0 >= strlen($versionColumn)) {
         throw new sfConfigurationException(sprintf('sfCacheTaggingPlugin: "%s" behaviors "versionColumn" ' . 'should be string and not empty, passed "%s"', sfCacheTaggingToolkit::TEMPLATE_NAME, (string) $versionColumn));
     }
 }
开发者ID:uniteddiversity,项目名称:policat,代码行数:15,代码来源:Cachetaggable.php

示例11: __construct

 /**
  * __construct 
  * 
  * @param array $options 
  * @return void
  */
 public function __construct(array $options)
 {
     $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
     if (!isset($this->_options['analyzer'])) {
         $this->_options['analyzer'] = new Doctrine_Search_Analyzer_Standard();
     }
     if (!isset($this->_options['connection'])) {
         $this->_options['connection'] = Doctrine_Manager::connection();
     }
 }
开发者ID:walterfrs,项目名称:mladek,代码行数:16,代码来源:Search.php

示例12: testImport

 public function testImport()
 {
     $this->dbh = new PDO('sqlite::memory:');
     $this->dbh->exec('CREATE TABLE import_test_user (id INTEGER PRIMARY KEY, name TEXT)');
     $this->conn = Doctrine_Manager::connection($this->dbh, 'tmp123');
     $this->conn->import->importSchema('Import/_files', array('tmp123'));
     $this->assertTrue(file_exists('Import/_files/ImportTestUser.php'));
     $this->assertTrue(file_exists('Import/_files/generated/BaseImportTestUser.php'));
     Doctrine_Lib::removeDirectories('Import/_files');
 }
开发者ID:swk,项目名称:bluebox,代码行数:10,代码来源:ImportTestCase.php

示例13: __construct

 /**
  * __construct 
  * 
  * @param array $options 
  * @return void
  */
 public function __construct(array $options)
 {
     $this->_options = Doctrine_Lib::arrayDeepMerge($this->_options, $options);
     if (!isset($this->_options['analyzer'])) {
         $this->_options['analyzer'] = 'Doctrine_Search_Analyzer_Standard';
     }
     if (!isset($this->_options['analyzer_options'])) {
         $this->_options['analyzer_options'] = array();
     }
     $this->_options['analyzer'] = new $this->_options['analyzer']($this->_options['analyzer_options']);
 }
开发者ID:dennybrandes,项目名称:doctrine1,代码行数:17,代码来源:Search.php

示例14: writeTableClassDefinition

 /**
  * writeTableClassDefinition
  *
  * @return void
  */
 public function writeTableClassDefinition(array $definition, $path, $options = array())
 {
     $className = $definition['tableClassName'];
     $pos = strpos($className, "Model_");
     $fileName = substr($className, $pos + 6) . $this->_suffix;
     $writePath = $path . DIRECTORY_SEPARATOR . $fileName;
     $content = $this->buildTableClassDefinition($className, $definition, $options);
     Doctrine_Lib::makeDirectories(dirname($writePath));
     Doctrine_Core::loadModel($className, $writePath);
     if (!file_exists($writePath)) {
         file_put_contents($writePath, $content);
     }
 }
开发者ID:lciolecki,项目名称:zf-doctrine,代码行数:18,代码来源:Builder.php

示例15: __construct

 /**
  * @param array $options
  *
  * options can contain:
  *
  *  - string   thumb_dir    The directory to create the thumbnails in (relative to the file's dirname)
  *  - boolean  on_demand    Whether to create or not thumbnails on demand
  *  - boolean  on_save      Whether to create or not thumbnails on save
  *  - boolean  strict       Whether to allow other formats than those in 'formats'
  *  - array    formats      Default formats to create for on_save
  *
  *  the 'formats' array should contain a list of formats per-field:
  *
  *  array(
  *    'media_id'    => array('50x50')
  *    'cover_image' => array('100x50')
  *  )
  */
 public function __construct(array $options = array())
 {
     if (!class_exists('sfThumbnail')) {
         throw new sfException('You need the sfThumbnailPlugin installed to use this template');
     }
     $app_config = array();
     if (isset($options['config_key'])) {
         if (null === ($app_config = sfConfig::get('app_' . $options['config_key'], null))) {
             throw new sfException(sprintf('Could not find configuration in key "%s", maybe you forget a ".plugins" in your app.yml ?', $options['config_key']));
         }
     }
     $this->options = Doctrine_Lib::arrayDeepMerge($this->options, $options, $app_config);
 }
开发者ID:ubermuda,项目名称:sfDoctrineThumbnailablePlugin,代码行数:31,代码来源:DoctrineThumbnailable.class.php


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