Deprecate MappingToExternalEntities model and stop creating its table

Since we are removing all the MP2 migration code the table
wp_mailpoet_mapping_to_external_entities is not needed anymore. It was
used to map MP2 objects to MP3 objects. This commit removes the code
that creates this table for new installs and deprecates its model.

[MAILPOET-4376]
This commit is contained in:
Rodrigo Primo
2022-07-06 20:09:09 -03:00
committed by Veljko V
parent d874375c25
commit 8d29c2df49
2 changed files with 25 additions and 13 deletions

View File

@ -2,12 +2,37 @@
namespace MailPoet\Models;
/**
* @deprecated This model is deprecated and there is no replacement.
* This class can be removed after 2023-01-06.
*/
class MappingToExternalEntities extends Model {
public static $_table = MP_MAPPING_TO_EXTERNAL_ENTITIES_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
/**
* @deprecated This is here for displaying the deprecation warning for properties.
*/
public function __get($key) {
self::deprecationError('property "' . $key . '"');
return parent::__get($key);
}
/**
* @deprecated This is here for displaying the deprecation warning for static calls.
*/
public static function __callStatic($name, $arguments) {
self::deprecationError($name);
return parent::__callStatic($name, $arguments);
}
public static function create($data = []) {
self::deprecationError(__METHOD__);
$relation = parent::create();
$relation->hydrate($data);
return $relation->save();
}
private static function deprecationError($methodName) {
trigger_error(' Calling ' . esc_html($methodName) . ' is deprecated and will be removed. There is no replacement.', E_USER_DEPRECATED);
}
}