Skip to content
Snippets Groups Projects
Select Git revision
  • 8c3158cf28a6711d61fd8b3dacccc6ad746be8d0
  • 3.9 default
  • develop
  • 6.0
  • 5.0
  • 4.0
  • scrutinizer-patch-4
  • scrutinizer-patch-3
  • scrutinizer-patch-2
  • scrutinizer-patch-1
  • 3.7
  • 3.8
  • 3.6
  • 3.9_backported
  • 3.8_backported
  • 3.7_backported
  • 3.5
  • 3.6_backported
  • 3.5_backported
  • 3.4
  • 3.3_backported
  • 6.0.4
  • 6.0.3
  • 5.0.7
  • 6.0.2
  • 6.0.1
  • 5.0.6
  • 6.0.0
  • 5.0.5
  • 6.0.0-rc
  • 5.0.4
  • 6.0.0-beta
  • 5.0.3
  • 4.0.6
  • 5.0.2
  • 5.0.1
  • 4.0.5
  • 5.0.0
  • 4.0.4
  • 5.0.0-rc2
  • 5.0.0-rc1
41 results

export.php

Blame
  • Table.php 5.84 KiB
    <?php
    
    require_once('Zend.php');
    
    Zend::loadInterface('Nmc_SingletonInterface');
    Zend::loadClass('Zend_Db_Table');
    
    abstract class Nmc_Db_Table
             extends Zend_Db_Table
             implements Nmc_SingletonInterface
    {
        public function _setup()
        {
            $selfInflection = new ReflectionObject($this);
            $docBlock = Nmc_DocBlock::createFromString($selfInflection->getDocComment());
    
            if (! $this->_name) {
                if($docBlock->table) {
                    $this->_name = $docBlock->table;
                } else {
                    $this->_name = DATABASE_TABLE_PREFIX . self::$_inflector->underscore(get_class($this));
                }
            }
    
            if ($this->_primary == 'id') {
                if($docBlock->primary) {
                    $this->_primary = $docBlock->primary;
                }
            }
    
            parent::_setup();
        }
    
        /**
         * find() - returns proper type of row
         *
         * @param mixed $val
         * @return Nmc_Db_Table_Row
         */
        public function find($val)
        {
            $row = parent::find($val);
            if(!$row) {
                return null;
            }
    
            $returnType = $this->getRowReturnType();
    
            $config = array('db'    => $this->getAdapter(),
                            'table' => $this,
                            'data'  => $row->toArray());
            return Nmc_Db_RowManager::getInstance()->getRow($returnType, $config);
        }
    
        /**
         * findAll() returns rows with primary keys listed in the array
         *
         * @param array $valArray
         * @return Nmc_Db_Table_Rowset
         */
        public function findAll($valArray) {
            if(!is_array($valArray) || count($valArray) == 0) {
                return $this->fetchNewRowset();
            }
            $where = $this->_db->quoteInto($this->_primary . ' IN (?)', $valArray);
            return $this->fetchAll($where);
        }
    
        /**
         * fetchNew() - returns proper type of row