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


PHP Zend_Tool_Project_Profile类代码示例

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


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

示例1: _connect

 /**
  *
  * @param Zend_Tool_Project_Profile $profile
  * @param type $adapter
  * @throws Zend_Tool_Project_Exception 
  */
 private function _connect(Zend_Tool_Project_Profile $profile, $adapter, $env = 'development')
 {
     $applicationConfigResource = $profile->search('ApplicationConfigFile');
     if ($env == null || $env == '') {
         $env = 'development';
     }
     if (!$applicationConfigResource) {
         throw new Zend_Tool_Project_Exception('A project with an application config file is required to use this provider.');
     }
     //$conn = 'testing';
     //$conn = 'development';
     $zf = $applicationConfigResource->getAsZendConfig($env);
     $this->_print('Conectado em ' . $env);
     #$zf = $applicationConfigResource->getAsZendConfig('testing');
     $_configDb = $zf->resources->multidb->{$adapter};
     if (!$_configDb) {
         throw new Zend_Tool_Project_Exception('Adapter not found in config application "resources.multidb.' . $adapter . '" .');
     }
     $configDb = array();
     $configDb['host'] = $_configDb->host;
     $configDb['username'] = $_configDb->username;
     $configDb['password'] = $_configDb->password;
     $configDb['dbname'] = $_configDb->dbname;
     $configDb['adapterNamespace'] = $_configDb->adapterNamespace;
     $configDb['options']['caseFolding'] = 1;
     $this->_dbAdapter = Zend_Db::factory($_configDb->adapter, $configDb);
 }
开发者ID:rtsantos,项目名称:mais,代码行数:33,代码来源:CrudTProvider.php

示例2: createResource

 /**
  * createResource()
  *
  * @param Zend_Tool_Project_Profile $profile
  * @param string $actionName
  * @param string $controllerName
  * @param string $moduleName
  * @return Zend_Tool_Project_Profile_Resource
  */
 public static function createResource(Zend_Tool_Project_Profile $profile, $actionName, $controllerName, $moduleName = null)
 {
     if (!is_string($actionName)) {
         //require_once 'Zend/Tool/Project/Provider/Exception.php';
         throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_View::createResource() expects \\"actionName\\" is the name of a controller resource to create.');
     }
     if (!is_string($controllerName)) {
         //require_once 'Zend/Tool/Project/Provider/Exception.php';
         throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_View::createResource() expects \\"controllerName\\" is the name of a controller resource to create.');
     }
     $profileSearchParams = array();
     if ($moduleName) {
         $profileSearchParams = array('modulesDirectory', 'moduleDirectory' => array('moduleName' => $moduleName));
         $noModuleSearch = null;
     } else {
         $noModuleSearch = array('modulesDirectory');
     }
     $profileSearchParams[] = 'viewsDirectory';
     $profileSearchParams[] = 'viewScriptsDirectory';
     if (($viewScriptsDirectory = $profile->search($profileSearchParams, $noModuleSearch)) === false) {
         //require_once 'Zend/Tool/Project/Provider/Exception.php';
         throw new Zend_Tool_Project_Provider_Exception('This project does not have a viewScriptsDirectory resource.');
     }
     $profileSearchParams['viewControllerScriptsDirectory'] = array('forControllerName' => $controllerName);
     // @todo check if below is failing b/c of above search params
     if (($viewControllerScriptsDirectory = $viewScriptsDirectory->search($profileSearchParams)) === false) {
         $viewControllerScriptsDirectory = $viewScriptsDirectory->createResource('viewControllerScriptsDirectory', array('forControllerName' => $controllerName));
     }
     $newViewScriptFile = $viewControllerScriptsDirectory->createResource('ViewScriptFile', array('forActionName' => $actionName));
     return $newViewScriptFile;
 }
开发者ID:schlypel,项目名称:YiiBackboneBoilerplate,代码行数:40,代码来源:View.php

示例3: create

 /**
  * create()
  *
  * @param string $path
  */
 public function create($path)
 {
     if ($path == null) {
         $path = getcwd();
     } else {
         $path = trim($path);
         if (!file_exists($path)) {
             $created = mkdir($path);
             if (!$created) {
                 require_once 'Zend/Tool/Framework/Client/Exception.php';
                 throw new Zend_Tool_Framework_Client_Exception('Could not create requested project directory \'' . $path . '\'');
             }
         }
         $path = str_replace('\\', '/', realpath($path));
     }
     $profile = $this->_loadProfile(self::NO_PROFILE_RETURN_FALSE, $path);
     if ($profile !== false) {
         require_once 'Zend/Tool/Framework/Client/Exception.php';
         throw new Zend_Tool_Framework_Client_Exception('A project already exists here');
     }
     $newProfile = new Zend_Tool_Project_Profile(array('projectDirectory' => $path, 'profileData' => $this->_getDefaultProfile()));
     $newProfile->loadFromData();
     $this->_registry->getResponse()->appendContent('Creating project at ' . $path);
     foreach ($newProfile->getIterator() as $resource) {
         $resource->create();
     }
 }
开发者ID:noriotakei,项目名称:suraimu,代码行数:32,代码来源:Project.php

示例4: _getModulesDirectoryPath

 /**
  * Method returns path to modules directory
  *
  * @param  Zend_Tool_Project_Profile $profile
  * @return string
  */
 protected static function _getModulesDirectoryPath(Zend_Tool_Project_Profile $profile)
 {
     $modulesDirectory = $profile->search(array('modulesDirectory'));
     if (!$modulesDirectory instanceof Zend_Tool_Project_Profile_Resource) {
         throw new Zend_Tool_Project_Provider_Exception("Modules resource undefined.");
     }
     return $modulesDirectory->getPath();
 }
开发者ID:shahmaulik,项目名称:zfcore,代码行数:14,代码来源:Abstract.php

示例5: _getModelsDirectoryResource

 /**
  * _getModelsDirectoryResource()
  *
  * @param Zend_Tool_Project_Profile $profile
  * @param string $moduleName
  * @return Zend_Tool_Project_Profile_Resource
  */
 protected static function _getModelsDirectoryResource(Zend_Tool_Project_Profile $profile, $moduleName = null)
 {
     $profileSearchParams = array();
     if ($moduleName != null && is_string($moduleName)) {
         $profileSearchParams = array('modulesDirectory', 'moduleDirectory' => array('moduleName' => $moduleName));
     }
     $profileSearchParams[] = 'modelsDirectory';
     return $profile->search($profileSearchParams);
 }
开发者ID:rdallasgray,项目名称:zf,代码行数:16,代码来源:Model.php

示例6: createResource

 /**
  * createResource()
  *
  * @param Zend_Tool_Project_Profile $profile
  * @param string $projectProviderName
  * @param string $actionNames
  * @return Zend_Tool_Project_Profile_Resource
  */
 public static function createResource(Zend_Tool_Project_Profile $profile, $projectProviderName, $actionNames = null)
 {
     if (!is_string($projectProviderName)) {
         throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_Controller::createResource() expects \\"projectProviderName\\" is the name of a project provider resource to create.');
     }
     $profileSearchParams = array();
     $profileSearchParams[] = 'projectProvidersDirectory';
     $projectProvider = $profile->createResourceAt($profileSearchParams, 'projectProviderFile', array('projectProviderName' => $projectProviderName, 'actionNames' => $actionNames));
     return $projectProvider;
 }
开发者ID:hjr3,项目名称:zf2,代码行数:18,代码来源:ProjectProvider.php

示例7: _getControllerFileResource

 /**
  * _getControllerFileResource()
  *
  * @param Zend_Tool_Project_Profile $profile
  * @param string $controllerName
  * @param string $moduleName
  * @return Zend_Tool_Project_Profile_Resource
  */
 protected static function _getControllerFileResource(Zend_Tool_Project_Profile $profile, $controllerName, $moduleName = null)
 {
     $profileSearchParams = array();
     if ($moduleName != null && is_string($moduleName)) {
         $profileSearchParams = array('modulesDirectory', 'moduleDirectory' => array('moduleName' => $moduleName));
     }
     $profileSearchParams[] = 'controllersDirectory';
     $profileSearchParams['zfsControllerFile'] = array('controllerName' => $controllerName);
     return $profile->search($profileSearchParams);
 }
开发者ID:omusico,项目名称:logica,代码行数:18,代码来源:ZfsAction.php

示例8: hasResource

 public static function hasResource(Zend_Tool_Project_Profile $profile, $dbTableName, $moduleName = null)
 {
     $profileSearchParams = array();
     if ($moduleName != null && is_string($moduleName)) {
         $profileSearchParams = array('modulesDirectory', 'moduleDirectory' => array('moduleName' => $moduleName));
     }
     $profileSearchParams[] = 'modelsDirectory';
     $modelsDirectory = $profile->search($profileSearchParams);
     if (!$modelsDirectory instanceof Zend_Tool_Project_Profile_Resource || !($dbTableDirectory = $modelsDirectory->search('DbTableDirectory'))) {
         return false;
     }
     $dbTableFile = $dbTableDirectory->search(array('DbTableFile' => array('dbTableName' => $dbTableName)));
     return $dbTableFile instanceof Zend_Tool_Project_Profile_Resource ? true : false;
 }
开发者ID:modulexcite,项目名称:zfopenid,代码行数:14,代码来源:DbTable.php

示例9: _unserializeRecurser

 /**
  * _unserializeRecurser()
  *
  * This method will be used to traverse the depths of the structure
  * as needed to *unserialize* the profile from an xmlIterator
  *
  * @param SimpleXMLIterator $xmlIterator
  * @param Zend_Tool_Project_Profile_Resource $resource
  */
 protected function _unserializeRecurser(SimpleXMLIterator $xmlIterator, Zend_Tool_Project_Profile_Resource $resource = null)
 {
     foreach ($xmlIterator as $resourceName => $resourceData) {
         $contextName = $resourceName;
         $subResource = new Zend_Tool_Project_Profile_Resource($contextName);
         $subResource->setProfile($this->_profile);
         if ($resourceAttributes = $resourceData->attributes()) {
             $attributes = array();
             foreach ($resourceAttributes as $attrName => $attrValue) {
                 $attributes[$attrName] = (string) $attrValue;
             }
             $subResource->setAttributes($attributes);
         }
         if ($resource) {
             $resource->append($subResource, false);
         } else {
             $this->_profile->append($subResource);
         }
         if ($this->_contextRepository->isOverwritableContext($contextName) == false) {
             $subResource->initializeContext();
         }
         if ($xmlIterator->hasChildren()) {
             self::_unserializeRecurser($xmlIterator->getChildren(), $subResource);
         }
     }
 }
开发者ID:c12g,项目名称:stratos-php,代码行数:35,代码来源:Xml.php

示例10: createResource

 public static function createResource(Zend_Tool_Project_Profile $profile, $layoutName = 'layout')
 {
     $applicationDirectory = $profile->search('applicationDirectory');
     $layoutDirectory = $applicationDirectory->search('layoutsDirectory');
     if ($layoutDirectory == false) {
         $layoutDirectory = $applicationDirectory->createResource('layoutsDirectory');
     }
     $layoutScriptsDirectory = $layoutDirectory->search('layoutScriptsDirectory');
     if ($layoutScriptsDirectory == false) {
         $layoutScriptsDirectory = $layoutDirectory->createResource('layoutScriptsDirectory');
     }
     $layoutScriptFile = $layoutScriptsDirectory->search('layoutScriptFile', array('layoutName' => 'layout'));
     if ($layoutScriptFile == false) {
         $layoutScriptFile = $layoutScriptsDirectory->createResource('layoutScriptFile', array('layoutName' => 'layout'));
     }
     return $layoutScriptFile;
 }
开发者ID:anunay,项目名称:stentors,代码行数:17,代码来源:Layout.php

示例11: create

 /**
  * create()
  *
  * @param string $path
  * @param string $nameOfProfile shortName=n
  * @param string $fileOfProfile shortName=f
  */
 public function create($path, $nameOfProfile = null, $fileOfProfile = null)
 {
     if ($path == null) {
         $path = getcwd();
     } else {
         $path = trim($path);
         if (!file_exists($path)) {
             $created = mkdir($path);
             if (!$created) {
                 require_once 'Zend/Tool/Framework/Client/Exception.php';
                 throw new Zend_Tool_Framework_Client_Exception('Could not create requested project directory \'' . $path . '\'');
             }
         }
         $path = str_replace('\\', '/', realpath($path));
     }
     $profile = $this->_loadProfile(self::NO_PROFILE_RETURN_FALSE, $path);
     if ($profile !== false) {
         require_once 'Zend/Tool/Framework/Client/Exception.php';
         throw new Zend_Tool_Framework_Client_Exception('A project already exists here');
     }
     $profileData = null;
     if ($fileOfProfile != null && file_exists($fileOfProfile)) {
         $profileData = file_get_contents($fileOfProfile);
     }
     $storage = $this->_registry->getStorage();
     if ($profileData == '' && $nameOfProfile != null && $storage->isEnabled()) {
         $profileData = $storage->get('project/profiles/' . $nameOfProfile . '.xml');
     }
     if ($profileData == '') {
         $profileData = $this->_getDefaultProfile();
     }
     $newProfile = new Zend_Tool_Project_Profile(array('projectDirectory' => $path, 'profileData' => $profileData));
     $newProfile->loadFromData();
     $response = $this->_registry->getResponse();
     $response->appendContent('Creating project at ' . $path);
     $response->appendContent('Note: ', array('separator' => false, 'color' => 'yellow'));
     $response->appendContent('This command created a web project, ' . 'for more information setting up your VHOST, please see docs/README');
     if (!Zend_Tool_Project_Provider_Test::isPHPUnitAvailable()) {
         $response->appendContent('Testing Note: ', array('separator' => false, 'color' => 'yellow'));
         $response->appendContent('PHPUnit was not found in your include_path, therefore no testing actions will be created.');
     }
     foreach ($newProfile->getIterator() as $resource) {
         $resource->create();
     }
 }
开发者ID:sepano,项目名称:open-social-media-monitoring,代码行数:52,代码来源:Project.php

示例12: connect

 /**
  *
  * @param Zend_Tool_Project_Profile $profile
  * @param type $adapter
  * @throws Zend_Tool_Project_Exception 
  */
 private function connect(Zend_Tool_Project_Profile $profile, $adapter)
 {
     $applicationConfigResource = $profile->search('ApplicationConfigFile');
     if (!$applicationConfigResource) {
         throw new Zend_Tool_Project_Exception('A project with an application config file is required to use this provider.');
     }
     $zf = $applicationConfigResource->getAsZendConfig();
     $_configDb = $zf->resources->multidb->{$adapter};
     if (!$_configDb) {
         throw new Zend_Tool_Project_Exception('Adapter not found in config application "resources.multidb.' . $adapter . '" .');
     }
     $configDb = array();
     $configDb['host'] = $_configDb->host;
     $configDb['username'] = $_configDb->username;
     $configDb['password'] = $_configDb->password;
     $configDb['dbname'] = $_configDb->dbname;
     $this->_dbAdapter = Zend_Db::factory($_configDb->adapter, $configDb);
 }
开发者ID:rtsantos,项目名称:mais,代码行数:24,代码来源:FormTProvider.php

示例13: hasResource

 public static function hasResource(Zend_Tool_Project_Profile $profile, $controllerName, $actionNameOrSimpleName, $moduleName = 'backoffice')
 {
     if ($moduleName == '' || $controllerName == '' || $actionNameOrSimpleName == '') {
         require_once 'Zend/Tool/Project/Provider/Exception.php';
         throw new Zend_Tool_Project_Provider_Exception('ModuleName and/or ControllerName and/or ActionName are empty.');
     }
     $profileSearchParams = array('modulesDirectory', 'moduleDirectory' => array('moduleName' => $moduleName), 'viewsDirectory', 'viewScriptsDirectory');
     if (($viewScriptsDirectory = $profile->search($profileSearchParams)) === false) {
         require_once 'Zend/Tool/Project/Provider/Exception.php';
         throw new Zend_Tool_Project_Provider_Exception('This project does not have a viewScriptsDirectory resource.');
     }
     $profileSearchParams['viewControllerScriptsDirectory'] = array('forControllerName' => $controllerName);
     //@FIXME Search returns false even on existance of search params.
     if (($viewControllerScriptsDirectory = $viewScriptsDirectory->search($profileSearchParams)) === false) {
         return false;
     }
     $profileSearchParams['zfsViewScriptFile'] = array('forActionName' => $actionNameOrSimpleName);
     return $viewControllerScriptsDirectory->search($profileSearchParams) instanceof Zend_Tool_Project_Profile_Resource;
 }
开发者ID:omusico,项目名称:logica,代码行数:19,代码来源:ZfsView.php

示例14: createLibraryResource

 /**
  * createLibraryResource()
  *
  * @param Zend_Tool_Project_Profile $profile
  * @param string $libraryClassName
  * @return Zend_Tool_Project_Profile_Resource
  */
 public static function createLibraryResource(Zend_Tool_Project_Profile $profile, $libraryClassName)
 {
     $testLibraryDirectoryResource = $profile->search(array('TestsDirectory', 'TestLibraryDirectory'));
     $fsParts = explode('_', $libraryClassName);
     $currentDirectoryResource = $testLibraryDirectoryResource;
     while ($nameOrNamespacePart = array_shift($fsParts)) {
         if (count($fsParts) > 0) {
             if (($libraryDirectoryResource = $currentDirectoryResource->search(array('TestLibraryNamespaceDirectory' => array('namespaceName' => $nameOrNamespacePart)))) === false) {
                 $currentDirectoryResource = $currentDirectoryResource->createResource('TestLibraryNamespaceDirectory', array('namespaceName' => $nameOrNamespacePart));
             } else {
                 $currentDirectoryResource = $libraryDirectoryResource;
             }
         } else {
             if (($libraryFileResource = $currentDirectoryResource->search(array('TestLibraryFile' => array('forClassName' => $libraryClassName)))) === false) {
                 $libraryFileResource = $currentDirectoryResource->createResource('TestLibraryFile', array('forClassName' => $libraryClassName));
             }
         }
     }
     return $libraryFileResource;
 }
开发者ID:hjr3,项目名称:zf2,代码行数:27,代码来源:Test.php

示例15: _getFormsDirectoryResource

 /**
  * _getFormsDirectoryResource()
  *
  * @param Zend_Tool_Project_Profile $profile
  * @return Zend_Tool_Project_Profile_Resource
  */
 protected static function _getFormsDirectoryResource(Zend_Tool_Project_Profile $profile, $module)
 {
     $profileSearchParams = array('modulesDirectory', 'moduleDirectory' => array('moduleName' => $module), 'formsDirectory');
     return $profile->search($profileSearchParams);
 }
开发者ID:omusico,项目名称:logica,代码行数:11,代码来源:ZfsForm.php


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