Skip to content

Conversation

@timstl
Copy link
Contributor

@timstl timstl commented Sep 23, 2022

Hello,

I have a set of dynamic data that includes both strings and arrays. Here's a sample of that data:

array (
  'sender' => 
  array (
    'firstName' => 'John',
    'fullName' => 'John doe',
    'email' => 'john@example.com',
  ),
  'state' => 'Colorado',
  'residence' => 'Nonresident',
  'year' => 2022,
  'licenses' => 
  array (
    0 => 
    array (
      'name' => 'Stamp',
      'cost' => '$10.59',
    ),
    1 => 
    array (
      'name' => 'Annual License',
      'cost' => '$86.50',
    ),
  ),
) 

I'm not sure if there's a better way to handle this, but type casting $value as a string was causing an error with the 'licenses' key, an array. Once removed, the data passed successfully to SendGrid and populated the template as expected.

@aozisik aozisik changed the base branch from master to dev September 24, 2022 13:18
@aozisik
Copy link
Contributor

aozisik commented Sep 24, 2022

Hi @timstl,

You're right! The underlying library does support other data types.
I'm going to this and create a new release. Thank you!

@aozisik aozisik merged commit 516187c into swiftmade:dev Sep 24, 2022
aozisik added a commit that referenced this pull request Sep 24, 2022
#8)

* add setSandboxMode method

* remove type casting to allow addDynamicTemplateData to accept arrays. (#7)

* update test cases

* add test case

* refactor

* update readme and changelog

Co-authored-by: Tim Gieseking <timstl@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants