Add magic getters for backward compatibility

[MAILPOET-3333]
This commit is contained in:
Pavel Dohnal
2020-12-02 10:29:06 +01:00
committed by Veljko V
parent 15ae8ae369
commit 06dca19738
5 changed files with 56 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ use MailPoet\Doctrine\EntityTraits\CreatedAtTrait;
use MailPoet\Doctrine\EntityTraits\DeletedAtTrait;
use MailPoet\Doctrine\EntityTraits\SafeToOneAssociationLoadTrait;
use MailPoet\Doctrine\EntityTraits\UpdatedAtTrait;
use MailPoet\Util\Helpers;
use MailPoetVendor\Doctrine\Common\Collections\ArrayCollection;
use MailPoetVendor\Doctrine\Common\Collections\Criteria;
use MailPoetVendor\Doctrine\ORM\Mapping as ORM;
@@ -157,6 +158,18 @@ class NewsletterEntity {
$this->queues = new ArrayCollection();
}
/**
* @deprecated This is here only for backward compatibility with custom shortcodes https://kb.mailpoet.com/article/160-create-a-custom-shortcode
* This can be removed after 2021-08-01
*/
public function __get($key) {
$getterName = 'get' . Helpers::underscoreToCamelCase($key, $capitaliseFirstChar = true);
$callable = [$this, $getterName];
if (is_callable($callable)) {
return call_user_func($callable);
}
}
public function __clone() {
// reset ID
$this->id = null;