Skip to content
This repository was archived by the owner on May 26, 2022. It is now read-only.
This repository was archived by the owner on May 26, 2022. It is now read-only.

Getting unsupported type exception for DateTime objects #833

Open
@sikhlana

Description

@sikhlana

Even though the plugin can detect DateTime objects:

if (CellTypeHelper::isDateTimeOrDateInterval($value)) {
return self::TYPE_DATE;
}

public static function isDateTimeOrDateInterval($value)
{
return (
$value instanceof \DateTime ||
$value instanceof \DateInterval
);
}

The writer does not have any appropriate parser for these objects and as a result my system is throwing this error:

Box\Spout\Common\Exception\InvalidArgumentException with message 'Trying to add a value with an unsupported type: object'

With a little bit of poking around, I found that this method is not being called anywhere within the package:

public function isDate()

Which in-turn throws the InvalidArgumentException here:

throw new InvalidArgumentException('Trying to add a value with an unsupported type: ' . \gettype($cell->getValue()));

I currently did an ugly hack to bypass this issue. Am I missing something here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions