Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle a non-existent field in an array #136

Merged
merged 1 commit into from
Jul 11, 2016
Merged

Handle a non-existent field in an array #136

merged 1 commit into from
Jul 11, 2016

Commits on Jul 9, 2016

  1. Handle a non-existent field in an array

    This was giving me an error, since I had several records for which a particular field was not defined.  Since I use a schema-less DB (MongoDB), this field doesn't even exist with a null value.  `data_get` performs an `array_key_exists` check before attempting to use `$part` as an index for the `$res` array.
    
    This entire method could actually be replaced with data_get for simplicity, since this is what Laravel uses internally to retrieve values in dot notation.
    ```php
    protected function extractCellValue($fieldName)
    {
        try {
            return data_get($this->src, $fieldName);
        } catch (Exception $e) {
            throw new RuntimeException(
                "Can't read '$fieldName' property from DataRow",
                0,
                $e
            );
        }
    }
    ```
    hackel authored Jul 9, 2016
    Configuration menu
    Copy the full SHA
    ed7cfe0 View commit details
    Browse the repository at this point in the history