ModelAbstract.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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-2009 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. */
  20. /** @see Zend_Db_Table */
  21. require_once 'Zend/Db/Table.php';
  22. /**
  23. * @see Zend_Registry
  24. * Seems to fix the file not being included by Zend_Db_Table...
  25. */
  26. require_once 'Zend/Registry.php';
  27. /**
  28. * @category Zend
  29. * @package Zend_Feed_Pubsubhubbub
  30. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  31. * @license http://framework.zend.com/license/new-bsd New BSD License
  32. */
  33. class Zend_Feed_Pubsubhubbub_Model_ModelAbstract
  34. {
  35. /**
  36. * Zend_Db_Table instance to host database methods
  37. *
  38. * @var Zend_Db_Table
  39. */
  40. protected $_db = null;
  41. /**
  42. * Constructor
  43. *
  44. * @param array $data
  45. * @param Zend_Db_Table_Abstract $tableGateway
  46. * @return void
  47. */
  48. public function __construct(Zend_Db_Table_Abstract $tableGateway = null)
  49. {
  50. if (is_null($tableGateway)) {
  51. $parts = explode('_', get_class($this));
  52. $table = strtolower(array_pop($parts));
  53. $this->_db = new Zend_Db_Table($table);
  54. } else {
  55. $this->_db = $tableGateway;
  56. }
  57. }
  58. }