web/lib/Zend/Tool/Project/Context/Zf/DbTableFile.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_Tool
    16  * @package    Zend_Tool
    17  * @subpackage Framework
    17  * @subpackage Framework
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  * @version    $Id: DbTableFile.php 20851 2010-02-02 21:45:51Z ralph $
    20  * @version    $Id: DbTableFile.php 24593 2012-01-05 20:35:02Z matthew $
    21  */
    21  */
    22 
    22 
    23 /**
    23 /**
    24  * This class is the front most class for utilizing Zend_Tool_Project
    24  * This class is the front most class for utilizing Zend_Tool_Project
    25  *
    25  *
    26  * A profile is a hierarchical set of resources that keep track of
    26  * A profile is a hierarchical set of resources that keep track of
    27  * items within a specific project.
    27  * items within a specific project.
    28  *
    28  *
    29  * @category   Zend
    29  * @category   Zend
    30  * @package    Zend_Tool
    30  * @package    Zend_Tool
    31  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    31  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    32  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    32  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    33  */
    33  */
    34 class Zend_Tool_Project_Context_Zf_DbTableFile extends Zend_Tool_Project_Context_Zf_AbstractClassFile
    34 class Zend_Tool_Project_Context_Zf_DbTableFile extends Zend_Tool_Project_Context_Zf_AbstractClassFile
    35 {
    35 {
    36 
    36 
    37     protected $_dbTableName = null;
    37     protected $_dbTableName = null;
    38     
    38 
    39     protected $_actualTableName = null;
    39     protected $_actualTableName = null;
    40     
    40 
    41     /**
    41     /**
    42      * getName()
    42      * getName()
    43      *
    43      *
    44      * @return string
    44      * @return string
    45      */
    45      */
    57         $this->_dbTableName = $this->_resource->getAttribute('dbTableName');
    57         $this->_dbTableName = $this->_resource->getAttribute('dbTableName');
    58         $this->_actualTableName = $this->_resource->getAttribute('actualTableName');
    58         $this->_actualTableName = $this->_resource->getAttribute('actualTableName');
    59         $this->_filesystemName = ucfirst($this->_dbTableName) . '.php';
    59         $this->_filesystemName = ucfirst($this->_dbTableName) . '.php';
    60         parent::init();
    60         parent::init();
    61     }
    61     }
    62     
    62 
    63     public function getPersistentAttributes()
    63     public function getPersistentAttributes()
    64     {
    64     {
    65         return array('dbTableName' => $this->_dbTableName);
    65         return array('dbTableName' => $this->_dbTableName);
    66     }
    66     }
    67 
    67 
    68     public function getContents()
    68     public function getContents()
    69     {
    69     {
    70         $className = $this->getFullClassName($this->_dbTableName, 'Model_DbTable');
    70         $className = $this->getFullClassName($this->_dbTableName, 'Model_DbTable');
    71         
    71 
    72         $codeGenFile = new Zend_CodeGenerator_Php_File(array(
    72         $codeGenFile = new Zend_CodeGenerator_Php_File(array(
    73             'fileName' => $this->getPath(),
    73             'fileName' => $this->getPath(),
    74             'classes' => array(
    74             'classes' => array(
    75                 new Zend_CodeGenerator_Php_Class(array(
    75                 new Zend_CodeGenerator_Php_Class(array(
    76                     'name' => $className,
    76                     'name' => $className,
    80                             'name' => '_name',
    80                             'name' => '_name',
    81                             'visibility' => Zend_CodeGenerator_Php_Property::VISIBILITY_PROTECTED,
    81                             'visibility' => Zend_CodeGenerator_Php_Property::VISIBILITY_PROTECTED,
    82                             'defaultValue' => $this->_actualTableName
    82                             'defaultValue' => $this->_actualTableName
    83                             ))
    83                             ))
    84                         ),
    84                         ),
    85                 
    85 
    86                     ))
    86                     ))
    87                 )
    87                 )
    88             ));
    88             ));
    89         return $codeGenFile->generate();
    89         return $codeGenFile->generate();
    90     }
    90     }
    91     
    91 
    92 }
    92 }