~ubuntu-branches/ubuntu/vivid/zendframework/vivid

« back to all changes in this revision

Viewing changes to library/Zend/Tool/Project/Provider/Application.php

  • Committer: Bazaar Package Importer
  • Author(s): Frank Habermann
  • Date: 2010-04-28 20:10:00 UTC
  • mfrom: (1.3.1 upstream) (9.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100428201000-o347bj5qb5i3tpot
Tags: 1.10.4-1
new upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    
34
34
    protected $_specialties = array('ClassNamePrefix');
35
35
    
36
 
    public function changeClassNamePrefix($classNamePrefix, $force = false)
 
36
    /**
 
37
     * 
 
38
     * @param $classNamePrefix Prefix of classes
 
39
     * @param $force
 
40
     */
 
41
    public function changeClassNamePrefix($classNamePrefix /* , $force = false */)
37
42
    {
38
43
        $profile = $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION);
39
44
        
 
45
        $originalClassNamePrefix = $classNamePrefix;
 
46
        
 
47
        if (substr($classNamePrefix, -1) != '_') {
 
48
            $classNamePrefix .= '_';
 
49
        }
 
50
        
40
51
        $configFileResource = $profile->search('ApplicationConfigFile');
41
52
        $zc = $configFileResource->getAsZendConfig('production');
42
53
        if ($zc->appnamespace == $classNamePrefix) {
55
66
        $applicationDirectory = $profile->search('ApplicationDirectory');
56
67
        $applicationDirectory->setClassNamePrefix($classNamePrefix);
57
68
 
 
69
        $response = $this->_registry->getResponse();
 
70
        
 
71
        if ($originalClassNamePrefix !== $classNamePrefix) {
 
72
            $response->appendContent(
 
73
                'Note: the name provided "' . $originalClassNamePrefix . '" was'
 
74
                    . ' altered to "' . $classNamePrefix . '" for correctness.',
 
75
                array('color' => 'yellow')
 
76
                );
 
77
        } 
 
78
        
58
79
        // note to the user
59
 
        $this->_registry->getResponse()->appendContent('application.ini updated with new appnamespace ' . $classNamePrefix);
60
 
        $this->_registry->getResponse()->appendContent('Note: All existing models will need to be altered to this new namespace by hand', array('color' => 'yellow'));
 
80
        $response->appendContent('Note: All existing models will need to be altered to this new namespace by hand', array('color' => 'yellow'));
 
81
        $response->appendContent('application.ini updated with new appnamespace ' . $classNamePrefix);
61
82
        
62
83
        // store profile
63
84
        $this->_storeProfile();