{"action":"opened","issue":{"url":"https://api.github.com/repos/yiisoft/yii2-swiftmailer/issues/9","labels_url":"https://api.github.com/repos/yiisoft/yii2-swiftmailer/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2-swiftmailer/issues/9/comments","events_url":"https://api.github.com/repos/yiisoft/yii2-swiftmailer/issues/9/events","html_url":"https://github.com/yiisoft/yii2-swiftmailer/issues/9","id":89127702,"number":9,"title":"Fatal PHP error when configuring a transport class with a protected property","user":{"login":"brandonkelly","id":47792,"avatar_url":"https://avatars.githubusercontent.com/u/47792?v=3","gravatar_id":"","url":"https://api.github.com/users/brandonkelly","html_url":"https://github.com/brandonkelly","followers_url":"https://api.github.com/users/brandonkelly/followers","following_url":"https://api.github.com/users/brandonkelly/following{/other_user}","gists_url":"https://api.github.com/users/brandonkelly/gists{/gist_id}","starred_url":"https://api.github.com/users/brandonkelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brandonkelly/subscriptions","organizations_url":"https://api.github.com/users/brandonkelly/orgs","repos_url":"https://api.github.com/users/brandonkelly/repos","events_url":"https://api.github.com/users/brandonkelly/events{/privacy}","received_events_url":"https://api.github.com/users/brandonkelly/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-17T21:15:48Z","updated_at":"2015-06-17T21:15:48Z","closed_at":null,"body":"If you try to configure yii\\swiftmailer\\Mailer with a Transport class that has getter/setter methods that correspond to a protected property, if you try to include that property in your Mailer config, it will result in a fatal PHP error because the `property_exists()` method on [line 231 of Mailer.php](https://github.com/yiisoft/yii2-swiftmailer/blob/master/Mailer.php#L231) will return true.\r\n\r\nHere’s a concrete example: I’m trying to connect my Yii application to Mandrill using the MandrillTransport class from the [accord/mandrill-swiftmailer](https://github.com/AccordGroup/MandrillSwiftMailer/blob/master/SwiftMailer/MandrillTransport.php) library. MandrillTransport has a [protected $apiKey property](https://github.com/AccordGroup/MandrillSwiftMailer/blob/master/SwiftMailer/MandrillTransport.php#L24) and a [public setApiKey() method](https://github.com/AccordGroup/MandrillSwiftMailer/blob/master/SwiftMailer/MandrillTransport.php#L64). So my mailer config is:\r\n\r\n```php\r\n'mailer' => [\r\n    'class' => 'yii\\swiftmailer\\Mailer',\r\n    'transport' => [\r\n        'class' => 'Accord\\MandrillSwiftMailer\\SwiftMailer\\MandrillTransport',\r\n        'constructArgs' => [\r\n            [\r\n                'class' => 'Swift_Events_SimpleEventDispatcher'\r\n            ]\r\n        ],\r\n        'apiKey' => 'XXXXXXXX',\r\n    ]\r\n]\r\n```\r\n\r\nI was expecting that yii\\swiftmailer\\Mailer would be smart enough to match the `apiKey` setting with the `setApiKey()` method, as that’s what the logic suggests it will do, but instead I got that fatal PHP error due to the protected `$apiKey` property."}}