(REF) TokenProcessor - Allowing adding rows by array
authorTim Otten <totten@civicrm.org>
Tue, 5 May 2020 05:54:38 +0000 (22:54 -0700)
committerTim Otten <totten@civicrm.org>
Tue, 5 May 2020 05:54:38 +0000 (22:54 -0700)
commit3faff3fcb0c52edb6041f1d4dba9f97883c95565
treed2f14909937e330bc6444d0e513b89bf98dfc509
parent8636893622b9f75180fab585f1467e301f1e0b7d
(REF) TokenProcessor - Allowing adding rows by array

Before
-------------------

When composing a message, you need to add a row and then use the fluent
`TokenRow` stub, eg:

```php
$p->addRow()->context(['contact_id' => 123]);
$p->addRow()->context(['contact_id' => 456]);
```

After
-------------------

When composing a message, you don't have to use the fluent `TokenRow` stub.
Just give an array:

```php
$p->addRow(['contact_id' => 123]);
$p->addRow(['contact_id' => 456]);
```

Or:

```php
$p->addRows([
  ['contact_id' => 123],
  ['contact_id' => 456],
]);
```

You still have the option of using the fluent interface.
Civi/Token/TokenProcessor.php
tests/phpunit/Civi/Token/TokenProcessorTest.php