Skip to content

Commit 0f18d79

Browse files
committed
Merge branch 'release/1.1.2'
2 parents 33185bc + 64f523d commit 0f18d79

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Release Notes for Webhooks for Craft CMS
22

3+
## 1.1.2 - 2018-12-21
4+
5+
### Changed
6+
- Webhook requests now include data for any magic event properties defined by `fields()`, if the event class implements `yii\base\Arrayable`. ([#2](https://github.com/craftcms/webhooks/issues/2))
7+
38
## 1.1.1 - 2018-12-17
49

510
### Added

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "craftcms/webhooks",
33
"description": "Post webhooks when events are triggered in Craft CMS.",
4-
"version": "1.1.1",
4+
"version": "1.1.2",
55
"type": "craft-plugin",
66
"keywords": [
77
"html",

src/Plugin.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ public function init()
7676
];
7777

7878
$eventAttributes = $webhook->getEventAttributes();
79-
foreach ((new \ReflectionObject($e))->getProperties() as $property) {
80-
if ($property->isPublic() && $property->getDeclaringClass()->getName() !== Event::class) {
81-
$name = $property->getName();
82-
$data['event'][$name] = $this->toArray($e->$name, $eventAttributes[$name] ?? []);
79+
$ref = new \ReflectionClass($e);
80+
foreach (ArrayHelper::toArray($e, [], false) as $name => $value) {
81+
if (!$ref->hasProperty($name) || $ref->getProperty($name)->getDeclaringClass()->getName() !== Event::class) {
82+
$data['event'][$name] = $this->toArray($value, $eventAttributes[$name] ?? []);
8383
}
8484
}
8585
}

0 commit comments

Comments
 (0)