db/SqlBuilder.php
/**
     * Retrieve all field names from object for SQL insert/update, but
     * exclude fields: primary ID field, field that has valid value
     * @param object/object array $object
     * @param bool $ignore_primary_key
     */
Retrieve all field names from object for SQL insert/update, but
exclude fields: primary ID field, field that has valid value
@param object/object array $object
@param bool $ignore_primary_key
Retrieve all field names from object for SQL insert / update but exclude fields : primary ID field field that has valid value @param object / object array $object @param bool $ignore_primary_key
private function object2CuFields($object, $ignore_primary_key) {
        $this->withData($object);
        $object2CuFields_func = function ($object) use($ignore_primary_key) {
            $all_vars = get_object_vars($object);
            if (! $all_vars) {
                throw new \InvalidArgumentException('Empty object for cu_fields');
            }
            $cu_fields = array();
            $primary_key_field = $this->_primary_key_field;
            foreach ($all_vars as $field => $value) {
                if ($this->isFieldHasNoData($value, $field) || $ignore_primary_key && $field == $primary_key_field) {
                    continue;
                }
                $cu_fields[] = $field;
            }
            if (empty($cu_fields)) {
                throw new \InvalidArgumentException('No data for fields');
            }
            $this->_cru_fields = $cu_fields;
        };
        if (is_object($object)) {
            $object2CuFields_func($object);
        } elseif (is_array($object) && isset($object[0]) && is_object($object[0])) {
            $object2CuFields_func($object[0]);
        } else {
            throw new \InvalidArgumentException('Invalid object for cu_fields');
        }
        return $this;
    }
private function object2CuFields ( $ object , $ ignore_primary_key ) { $ this -> withData ( $ object ) ; $ object2CuFields_func = function ( $ object ) use ( $ ignore_primary_key ) { $ all_vars = get_object_vars ( $ object ) ; if ( ! $ all_vars ) { throw new \ InvalidArgumentException ( 'Empty object for cu_fields' ) ; } $ cu_fields = array ( ) ; $ primary_key_field = $ this -> _primary_key_field ; foreach ( $ all_vars as $ field => $ value ) { if ( $ this -> isFieldHasNoData ( $ value , $ field ) || $ ignore_primary_key && $ field == $ primary_key_field ) { continue ; } $ cu_fields [ ] = $ field ; } if ( empty ( $ cu_fields ) ) { throw new \ InvalidArgumentException ( 'No data for fields' ) ; } $ this -> _cru_fields = $ cu_fields ; } ; if ( is_object ( $ object ) ) { $ object2CuFields_func ( $ object ) ; } elseif ( is_array ( $ object ) && isset ( $ object [ 0 ] ) && is_object ( $ object [ 0 ] ) ) { $ object2CuFields_func ( $ object [ 0 ] ) ; } else { throw new \ InvalidArgumentException ( 'Invalid object for cu_fields' ) ; } return $ this ; }
Retrieve all field names from object for SQL insert/update, but
 exclude fields: primary ID field, field that has valid value
 @param object/object array $object
 @param bool $ignore_primary_key
Retrieve all field names from object for SQL insert / update but exclude fields : primary ID field field that has valid value @param object / object array $object @param bool $ignore_primary_key