[message Uncaught PDOException: You cannot serialize or unserialize PDO instances

Ich habe eine zusätzliche Klasse in einem bestehenden Modul hinzugefügt, um OxidEsales\Eshop\Core\Element2ShopRelations zu überschreiben

source\modules-xxx\abc\Vouchers\Core\Element2ShopRelations.php

namespace Xxx\Abc\Vouchers\Core;

class Element2ShopRelations extends Element2ShopRelations_parent {

public function __sleep()
{
    $_oDb = null;
}

}

source\modules-xxx\abc\metadata.php

'extend'        => array(
    \OxidEsales\Eshop\Core\Element2ShopRelations::class  => \Xxx\Abc\Vouchers\Core\Element2ShopRelations::class
), 

Es funktioniert alles wie gewünscht (PDOException: You cannot serialize or unserialize PDO instances Meldung ist behoben)

Mir fällt auf, dass Element2ShopRelations den folgenden Hinweis hat:

/**

  • Class Article2ShopRelations
  • IMPORTANT:
  • This class has been generated by a script and is not meant to be edited.
  • Any changes will get lost during the next script run.
  • @package OxidEsales\Eshop\Core
    */

Kann mir jemand sagen ob ich richtig vorgegangen bin? Wie würdet ihr die Klasse Element2ShopRelations um die Methode _sleep() erweitern?