protected function Autogen(array $attrs) {
        $ignore = !empty($attrs['ignore']) ? explode('|', $attrs['ignore']) : array();
        $er = error_reporting(0);
        ob_start();
        $classPath = $this->openClassForWriting();
        $methods = '';
        foreach ($this->_table->getColumns() as $name => $attrsRow) {
            if (in_array(Util::camelTo_($name), $ignore))
                continue;
            echo "\r\n";
            echo "\t/**\r\n";
            echo "\t * @DBS\\" . $this->fetchColumnProperties($attrsRow) . "\r\n";
            echo "\t */\r\n";
            echo "\tprotected $" . Util::_toCamel($name) . ";\r\n";

            $methods .= "\r\n";
            $methods .= "\tpublic function set" . ucfirst(Util::_toCamel($name)) . '($' . Util::_toCamel($name) . ") {\r\n";
            $methods .= "\t\t" . '$this->' . Util::_toCamel($name) . ' = $' . Util::_toCamel($name) . ";\r\n";
            $methods .= "\t\t" . 'return $this;' . "\r\n";
            $methods .= "\t}\r\n";

            $methods .= "\r\n";
            $methods .= "\tpublic function get" . ucfirst(Util::_toCamel($name)) . "() {\r\n";
            $methods .= "\t\t" . 'return $this->' . Util::_toCamel($name) . ";\r\n";
            $methods .= "\t}\r\n";
        }
        echo $methods . "\r\n";
        echo "}\r\n";
        error_reporting($er);
        return file_put_contents($classPath, ob_get_clean());
    }
protected function Autogen(array $attrs) {
        $ignore = !empty($attrs['ignore']) ? explode('|', $attrs['ignore']) : array();
        $er = error_reporting(0);
        ob_start();
        $classPath = $this->openClassForWriting();
        $methods = '';
        foreach ($this->_table->getColumns() as $name => $attrsRow) {
            if (in_array(Util::camelTo_($name), $ignore))
                continue;
            echo "\r\n";
            echo "\t/**\r\n";
            echo "\t * @DBS\\" . $this->fetchColumnProperties($attrsRow) . "\r\n";
            echo "\t */\r\n";
            echo "\tprotected $" . Util::_toCamel($name) . ";\r\n";

            $methods .= "\r\n";
            $methods .= "\tpublic function set" . ucfirst(Util::_toCamel($name)) . '($' . Util::_toCamel($name) . ") {\r\n";
            $methods .= "\t\t" . '$this->' . Util::_toCamel($name) . ' = $' . Util::_toCamel($name) . ";\r\n";
            $methods .= "\t\t" . 'return $this;' . "\r\n";
            $methods .= "\t}\r\n";

            $methods .= "\r\n";
            $methods .= "\tpublic function get" . ucfirst(Util::_toCamel($name)) . "() {\r\n";
            $methods .= "\t\t" . 'return $this->' . Util::_toCamel($name) . ";\r\n";
            $methods .= "\t}\r\n";
        }
        echo $methods . "\r\n";
        echo "}\r\n";
        error_reporting($er);
        return file_put_contents($classPath, ob_get_clean());
    }
protected function Autogen ( array $ attrs ) { $ ignore = ! empty ( $ attrs [ 'ignore' ] ) ? explode ( '|' , $ attrs [ 'ignore' ] ) : array ( ) ; $ er = error_reporting ( 0 ) ; ob_start ( ) ; $ classPath = $ this -> openClassForWriting ( ) ; $ methods = '' ; foreach ( $ this -> _table -> getColumns ( ) as $ name => $ attrsRow ) { if ( in_array ( Util :: camelTo_ ( $ name ) , $ ignore ) ) continue ; echo "\r\n" ; echo "\t/**\r\n" ; echo "\t * @DBS\\" . $ this -> fetchColumnProperties ( $ attrsRow ) . "\r\n" ; echo "\t */\r\n" ; echo "\tprotected $" . Util :: _toCamel ( $ name ) . ";\r\n" ; $ methods .= "\r\n" ; $ methods .= "\tpublic function set" . ucfirst ( Util :: _toCamel ( $ name ) ) . '($' . Util :: _toCamel ( $ name ) . ") {\r\n" ; $ methods .= "\t\t" . '$this->' . Util :: _toCamel ( $ name ) . ' = $' . Util :: _toCamel ( $ name ) . ";\r\n" ; $ methods .= "\t\t" . 'return $this;' . "\r\n" ; $ methods .= "\t}\r\n" ; $ methods .= "\r\n" ; $ methods .= "\tpublic function get" . ucfirst ( Util :: _toCamel ( $ name ) ) . "() {\r\n" ; $ methods .= "\t\t" . 'return $this->' . Util :: _toCamel ( $ name ) . ";\r\n" ; $ methods .= "\t}\r\n" ; } echo $ methods . "\r\n" ; echo "}\r\n" ; error_reporting ( $ er ) ; return file_put_contents ( $ classPath , ob_get_clean ( ) ) ; }
Auto generates the class from an existing table in the database
@param array $attrs
@return boolean
Auto generates the class from an existing table in the database