Open vmrfriz opened 1 year ago
Hi @vmrfriz , many thanks for your suggestion. I like the idea, but I'm afraid of another big "thing" - how to handle the active client connection? Or have you tested it and it already restores itself somehow?
If you would like to tackle this and perhaps create a pull request, please feel welcome to do so over here: https://github.com/Webklex/php-imap
webklex/php-imap
is the core library this laravel package utilizes.
Best regards and happy coding,
Is your feature request related to a problem? Please describe. Using laravel-imap, I receive emails from mail and pass them to handlers in laravel queues. When passed to the queue, the object is serialized to JSON in the
Illuminate\Queue\Queue::create Payload()
method. As a result, I get an error:Describe the solution you'd like For the solution, I added the methods
__serialize()
and__unserialize
to the event object. After studying the source code of the\Webklex\PHPIMAP\Message
class, I decided to do it by analogy with thesave()
andfromString()
methods. It turned out the following:I think the same solution can be applied for the
\Webklex\PHPIMAP\Message
classDescribe alternatives you've considered Initially, I tried to solve the problem by serializing the \Webklex\PHPIMAP\Message object, but I wanted the event to accept an instance of the class, not a string.
In addition,
serialize()
andunserialize()
incorrectly expand Attribute and adjacent objects. I found this fix in the issue to webklex\phpimap: #179.Additional context Without initializing
new Client Manager();
, the method\Webklex\PHPIMAP\Message::fromString()
does not work. Therefore, I had to initialize it in the__unserialize()
method. Perhaps there is a better solution?This is what I get if I don't initialize
new \Webklex\PHPIMAP\ClientManager()
: