|
|
@ -212,6 +212,7 @@ class Mailer extends BaseMailer |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw new InvalidConfigException('Object configuration must be an array containing a "class" element.'); |
|
|
|
throw new InvalidConfigException('Object configuration must be an array containing a "class" element.'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isset($config['constructArgs'])) { |
|
|
|
if (isset($config['constructArgs'])) { |
|
|
|
$args = []; |
|
|
|
$args = []; |
|
|
|
foreach ($config['constructArgs'] as $arg) { |
|
|
|
foreach ($config['constructArgs'] as $arg) { |
|
|
@ -226,13 +227,15 @@ class Mailer extends BaseMailer |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$object = Yii::createObject($className); |
|
|
|
$object = Yii::createObject($className); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($config)) { |
|
|
|
if (!empty($config)) { |
|
|
|
|
|
|
|
$reflection = new \ReflectionObject($object); |
|
|
|
foreach ($config as $name => $value) { |
|
|
|
foreach ($config as $name => $value) { |
|
|
|
if (property_exists($object, $name)) { |
|
|
|
if ($reflection->hasProperty($name) && $reflection->getProperty($name)->isPublic()) { |
|
|
|
$object->$name = $value; |
|
|
|
$object->$name = $value; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$setter = 'set' . $name; |
|
|
|
$setter = 'set' . $name; |
|
|
|
if (method_exists($object, $setter) || method_exists($object, '__call')) { |
|
|
|
if ($reflection->hasMethod($setter) || $reflection->hasMethod('__call')) { |
|
|
|
$object->$setter($value); |
|
|
|
$object->$setter($value); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw new InvalidConfigException('Setting unknown property: ' . $className . '::' . $name); |
|
|
|
throw new InvalidConfigException('Setting unknown property: ' . $className . '::' . $name); |
|
|
|