public static function getModelKeys($model, $includePrimary = true)
    {
        $keys = array_map(function ($foreignKey) {
            array_shift($foreignKey);
            return array_keys($foreignKey);
        }, $model->getTableSchema()->foreignKeys);
        if ($includePrimary) {
            $keys[] = $model->primaryKey();
        }
        return call_user_func_array('array_merge', $keys);
    }
public static function getModelKeys($model, $includePrimary = true)
    {
        $keys = array_map(function ($foreignKey) {
            array_shift($foreignKey);
            return array_keys($foreignKey);
        }, $model->getTableSchema()->foreignKeys);
        if ($includePrimary) {
            $keys[] = $model->primaryKey();
        }
        return call_user_func_array('array_merge', $keys);
    }
public static function getModelKeys ( $ model , $ includePrimary = true ) { $ keys = array_map ( function ( $ foreignKey ) { array_shift ( $ foreignKey ) ; return array_keys ( $ foreignKey ) ; } , $ model -> getTableSchema ( ) -> foreignKeys ) ; if ( $ includePrimary ) { $ keys [ ] = $ model -> primaryKey ( ) ; } return call_user_func_array ( 'array_merge' , $ keys ) ; }
Returns all primary and foreign key column names for specified model.
@param ActiveRecord $model
@param bool $includePrimary
@return array names of columns from primary and foreign keys
Returns all primary and foreign key column names for specified model .