src/Driver/DC_Table_Utils.php
public static function createFromModelData(array $modelData, string $table, string $field = null)
    {
        $dc = new static($table);

        $dc->strTable = $table;
        $dc->activeRecord = null;

        if (isset($modelData['id']) && $modelData['id'] > 0) {
            $dc->activeRecord = System::getContainer()->get('huh.utils.model')->findModelInstanceByPk($table, $modelData['id']);
            $dc->intId = $modelData['id'];
        }

        if ($field) {
            $dc->strField = $field;
        }

        return $dc;
    }
public static function createFromModelData(array $modelData, string $table, string $field = null)
    {
        $dc = new static($table);

        $dc->strTable = $table;
        $dc->activeRecord = null;

        if (isset($modelData['id']) && $modelData['id'] > 0) {
            $dc->activeRecord = System::getContainer()->get('huh.utils.model')->findModelInstanceByPk($table, $modelData['id']);
            $dc->intId = $modelData['id'];
        }

        if ($field) {
            $dc->strField = $field;
        }

        return $dc;
    }
public static function createFromModelData ( array $ modelData , string $ table , string $ field = null ) { $ dc = new static ( $ table ) ; $ dc -> strTable = $ table ; $ dc -> activeRecord = null ; if ( isset ( $ modelData [ 'id' ] ) && $ modelData [ 'id' ] > 0 ) { $ dc -> activeRecord = System :: getContainer ( ) -> get ( 'huh.utils.model' ) -> findModelInstanceByPk ( $ table , $ modelData [ 'id' ] ) ; $ dc -> intId = $ modelData [ 'id' ] ; } if ( $ field ) { $ dc -> strField = $ field ; } return $ dc ; }
Create a DataContainer instance from given model data.

@param Model  $model
@param string $table
@param string $field

@return static
Create a DataContainer instance from given model data .