klaviyo / php-klaviyo

PHP wrapper for the Klaviyo API
59 stars 47 forks source link

Exception When Time Is Provided #31

Closed cbarranco closed 3 years ago

cbarranco commented 3 years ago

If a time is provided in the $config array, an error is thrown on line 56 of EventModel:

Cannot use object of type DateTime as array

56 $this->time = !empty($config['time']) ? strtotime( $time['date'] ) : null;

You cannot access the 'date' property of a DateTime object directly, it needs to be changed to

56 $this->time = !empty($config['time']) ? strtotime( $time->format('Y-m-d H:i:s') : null;

remstone7 commented 3 years ago

resolved in 2.2.2