當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。