Library/Bullhorn/FastRest/Generator/ModelBuilder.php
private function buildFields() {
        $fields = array();
        /** @var ResultSet $results */
        $results = $this->getConfiguration()->getConnection()->query('SHOW COLUMNS FROM `' . $this->getTableName() . '`');
        $dbName = $this->getCurrentDatabaseName();
        while($result = $results->fetch()) {
            $result = (object)$result;
            $params = array($dbName, $this->getTableName(), $result->Field);
            /** @var ResultSet $informationResults */
            $informationResults = $this->getConfiguration()->getInformationSchemaConnection()->query(
                'SELECT * FROM `COLUMNS` WHERE TABLE_SCHEMA=? AND TABLE_NAME=? AND COLUMN_NAME=?',
                $params
            );
            /** @var \stdClass $informationResult */
            $informationResult = (object)$informationResults->fetch();
            $field = new Field($result, $this->getTableName(), $informationResult);
            switch($field->getType()) {
                case 'Date':
                    $this->getAbstractClass()->addUse($this->getConfiguration()->getDateClassName());
                    break;
                case 'DateTime':
                    $this->getAbstractClass()->addUse($this->getConfiguration()->getDateTimeClassName());
                    break;
            }
            $fields[] = $field;
        }
        usort(
            $fields,
            function (Field $fieldA, Field $fieldB) {
                return strcasecmp($fieldA->getShortName(), $fieldB->getShortName());
            }
        );
        $this->setFields($fields);
    }
private function buildFields() {
        $fields = array();
        /** @var ResultSet $results */
        $results = $this->getConfiguration()->getConnection()->query('SHOW COLUMNS FROM `' . $this->getTableName() . '`');
        $dbName = $this->getCurrentDatabaseName();
        while($result = $results->fetch()) {
            $result = (object)$result;
            $params = array($dbName, $this->getTableName(), $result->Field);
            /** @var ResultSet $informationResults */
            $informationResults = $this->getConfiguration()->getInformationSchemaConnection()->query(
                'SELECT * FROM `COLUMNS` WHERE TABLE_SCHEMA=? AND TABLE_NAME=? AND COLUMN_NAME=?',
                $params
            );
            /** @var \stdClass $informationResult */
            $informationResult = (object)$informationResults->fetch();
            $field = new Field($result, $this->getTableName(), $informationResult);
            switch($field->getType()) {
                case 'Date':
                    $this->getAbstractClass()->addUse($this->getConfiguration()->getDateClassName());
                    break;
                case 'DateTime':
                    $this->getAbstractClass()->addUse($this->getConfiguration()->getDateTimeClassName());
                    break;
            }
            $fields[] = $field;
        }
        usort(
            $fields,
            function (Field $fieldA, Field $fieldB) {
                return strcasecmp($fieldA->getShortName(), $fieldB->getShortName());
            }
        );
        $this->setFields($fields);
    }
private function buildFields ( ) { $ fields = array ( ) ; /** @var ResultSet $results */ $ results = $ this -> getConfiguration ( ) -> getConnection ( ) -> query ( 'SHOW COLUMNS FROM `' . $ this -> getTableName ( ) . '`' ) ; $ dbName = $ this -> getCurrentDatabaseName ( ) ; while ( $ result = $ results -> fetch ( ) ) { $ result = ( object ) $ result ; $ params = array ( $ dbName , $ this -> getTableName ( ) , $ result -> Field ) ; /** @var ResultSet $informationResults */ $ informationResults = $ this -> getConfiguration ( ) -> getInformationSchemaConnection ( ) -> query ( 'SELECT * FROM `COLUMNS` WHERE TABLE_SCHEMA=? AND TABLE_NAME=? AND COLUMN_NAME=?' , $ params ) ; /** @var \stdClass $informationResult */ $ informationResult = ( object ) $ informationResults -> fetch ( ) ; $ field = new Field ( $ result , $ this -> getTableName ( ) , $ informationResult ) ; switch ( $ field -> getType ( ) ) { case 'Date' : $ this -> getAbstractClass ( ) -> addUse ( $ this -> getConfiguration ( ) -> getDateClassName ( ) ) ; break ; case 'DateTime' : $ this -> getAbstractClass ( ) -> addUse ( $ this -> getConfiguration ( ) -> getDateTimeClassName ( ) ) ; break ; } $ fields [ ] = $ field ; } usort ( $ fields , function ( Field $ fieldA , Field $ fieldB ) { return strcasecmp ( $ fieldA -> getShortName ( ) , $ fieldB -> getShortName ( ) ) ; } ) ; $ this -> setFields ( $ fields ) ; }
Builds the fields and types
@return void
Builds the fields and types