web/lib/Zend/Feed/Pubsubhubbub/Model/ModelAbstract.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     1 <?php
       
     2 /**
       
     3  * Zend Framework
       
     4  *
       
     5  * LICENSE
       
     6  *
       
     7  * This source file is subject to the new BSD license that is bundled
       
     8  * with this package in the file LICENSE.txt.
       
     9  * It is also available through the world-wide-web at this URL:
       
    10  * http://framework.zend.com/license/new-bsd
       
    11  * If you did not receive a copy of the license and are unable to
       
    12  * obtain it through the world-wide-web, please send an email
       
    13  * to license@zend.com so we can send you a copy immediately.
       
    14  *
       
    15  * @category   Zend
       
    16  * @package    Zend_Feed_Pubsubhubbub
       
    17  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    18  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    19  * @version    $Id: ModelAbstract.php 22662 2010-07-24 17:37:36Z mabe $
       
    20  */
       
    21 
       
    22 
       
    23 /** @see Zend_Db_Table */
       
    24 require_once 'Zend/Db/Table.php';
       
    25 
       
    26 /** 
       
    27  * @see Zend_Registry
       
    28  * Seems to fix the file not being included by Zend_Db_Table...
       
    29  */
       
    30 require_once 'Zend/Registry.php';
       
    31 
       
    32 /**
       
    33  * @category   Zend
       
    34  * @package    Zend_Feed_Pubsubhubbub
       
    35  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    36  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    37  */
       
    38 class Zend_Feed_Pubsubhubbub_Model_ModelAbstract
       
    39 {
       
    40     /**
       
    41      * Zend_Db_Table instance to host database methods
       
    42      *
       
    43      * @var Zend_Db_Table
       
    44      */
       
    45     protected $_db = null;
       
    46  
       
    47     /**
       
    48      * Constructor
       
    49      * 
       
    50      * @param  array $data 
       
    51      * @param  Zend_Db_Table_Abstract $tableGateway 
       
    52      * @return void
       
    53      */
       
    54     public function __construct(Zend_Db_Table_Abstract $tableGateway = null)
       
    55     {
       
    56         if ($tableGateway === null) {
       
    57             $parts = explode('_', get_class($this));
       
    58             $table = strtolower(array_pop($parts));
       
    59             $this->_db = new Zend_Db_Table($table);
       
    60         } else {
       
    61             $this->_db = $tableGateway;
       
    62         }
       
    63     }
       
    64 
       
    65 }