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


PHP ClassMethods::setNamingStrategy方法代码示例

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


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

示例1: buildHydrator

 protected function buildHydrator($product, $direction)
 {
     $this->assertOptionsValid();
     $config = $this->options->getConfig();
     $class = $this->options->getClass();
     $hydrator = new ClassMethods();
     if (!isset($config[$this->options->getClass()][$product])) {
         return $hydrator;
     }
     $tmp = new Config(array());
     if (isset($config[$class]['*'])) {
         $tmp = new Config($config[$class]['*']);
     }
     if (isset($config[$class][$product])) {
         $productConfig = new Config($config[$class][$product]);
         $tmp = $productConfig->merge($tmp);
     }
     $config = $tmp['shared'];
     if (isset($tmp[$direction])) {
         $config->merge($tmp[$direction]);
     }
     $config = $config->toArray();
     if (!empty($config['map'])) {
         $hydrator->setNamingStrategy(new ArrayMapNamingStrategy($config['map']));
     }
     if (!empty($config['strategy'])) {
         foreach ($config['strategy'] as $name => $strategyCallback) {
             $hydrator->addStrategy($name, $strategyCallback());
         }
     }
     if (!empty($config['options'])) {
         $this->options->setFromArray($config['options']);
     }
     return $hydrator;
 }
开发者ID:pay4later,项目名称:php-task,代码行数:35,代码来源:AbstractClassAdapter.php

示例2: createService

 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $dbAdapter = $serviceLocator->get('Zend\\Db\\Adapter\\Adapter');
     $hydrator = new ClassMethods();
     $names = array(DbViewSites::SITEID => 'id');
     $hydrator->setNamingStrategy(new MapNamingStrategy($names));
     $prototype = $serviceLocator->get('SitePrototype');
     return new SiteDbSqlMapper($dbAdapter, $hydrator, $prototype, DbViewSites::TABLE, DbViewSites::SITEID);
 }
开发者ID:FiftyNine,项目名称:ScpperDB,代码行数:9,代码来源:SiteDbSqlMapperFactory.php

示例3: createService

 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $dbAdapter = $serviceLocator->get('Zend\\Db\\Adapter\\Adapter');
     $hydrator = new ClassMethods();
     $names = new \Zend\Stdlib\Hydrator\NamingStrategy\MapNamingStrategy(array(DbViewAuthors::ROLEID => 'role'));
     $hydrator->setNamingStrategy($names);
     $prototype = $serviceLocator->get('AuthorshipPrototype');
     return new AuthorshipDbSqlMapper($dbAdapter, $hydrator, $prototype, DbViewAuthors::TABLE, '');
 }
开发者ID:FiftyNine,项目名称:ScpperDB,代码行数:9,代码来源:AuthorshipDbSqlMapperFactory.php

示例4: createService

 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $dbAdapter = $serviceLocator->get('Zend\\Db\\Adapter\\Adapter');
     $hydrator = new ClassMethods();
     $namingStrat = new \Zend\Stdlib\Hydrator\NamingStrategy\MapNamingStrategy(array(DbViewPages::PAGEID => 'id', DbViewPages::PAGENAME => 'name', DbViewPages::REVISIONS => 'revisionCount', DbViewPages::STATUSID => 'status', DbViewPages::STATUS => '', DbViewPages::KINDID => 'kind', DbViewPages::KIND => ''));
     $hydrator->setNamingStrategy($namingStrat);
     $hydrator->addStrategy(DbViewPages::CREATIONDATE, new \Zend\Stdlib\Hydrator\Strategy\DateTimeFormatterStrategy('Y-m-d H:i:s'));
     $prototype = $serviceLocator->get('PagePrototype');
     return new PageDbSqlMapper($dbAdapter, $hydrator, $prototype, DbViewPages::TABLE, DbViewPages::PAGEID);
 }
开发者ID:FiftyNine,项目名称:ScpperDB,代码行数:10,代码来源:PageDbSqlMapperFactory.php

示例5: createService

 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $dbAdapter = $serviceLocator->get('Zend\\Db\\Adapter\\Adapter');
     $hydrator = new ClassMethods();
     $names = array(DbViewRevisions::REVISIONID => 'id', DbViewRevisions::REVISIONINDEX => 'index');
     $hydrator->setNamingStrategy(new MapNamingStrategy($names));
     $hydrator->addStrategy(DbViewRevisions::DATETIME, new \Zend\Stdlib\Hydrator\Strategy\DateTimeFormatterStrategy('Y-m-d H:i:s'));
     $prototype = $serviceLocator->get('RevisionPrototype');
     return new RevisionDbSqlMapper($dbAdapter, $hydrator, $prototype, DbViewRevisions::TABLE, DbViewRevisions::REVISIONID);
 }
开发者ID:FiftyNine,项目名称:ScpperDB,代码行数:10,代码来源:RevisionDbSqlMapperFactory.php


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