Remove models that were deprecated over six months ago

The removal date of all these models passed a couple of months ago.

[MAILPOET-5252]
This commit is contained in:
Rodrigo Primo
2023-04-20 11:10:53 -03:00
committed by Oluwaseun Olorunsola
parent 5a85390655
commit 854e8a7f07
8 changed files with 0 additions and 265 deletions

View File

@@ -1,74 +0,0 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Models;
use MailPoet\Util\Helpers;
use MailPoet\WP\Functions as WPFunctions;
/**
* @property array|string|null $filterData
* @property string $segmentId
* @deprecated This model is deprecated. Use \MailPoet\Segments\DynamicSegments\DynamicSegmentFilterRepository and
* \MailPoet\Entities\DynamicSegmentFilterEntity.
* This class can be removed after 2022-11-04.
*/
class DynamicSegmentFilter extends Model {
public static $_table = MP_DYNAMIC_SEGMENTS_FILTERS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public function save() {
self::deprecationError(__METHOD__);
if (is_null($this->filterData)) {
$this->filterData = [];
}
if (!WPFunctions::get()->isSerialized($this->filterData)) {
$this->filterData = serialize($this->filterData);
}
return parent::save();
}
public static function getAllBySegmentIds($segmentIds) {
self::deprecationError(__METHOD__);
if (empty($segmentIds)) return [];
$query = self::tableAlias('filters')
->whereIn('filters.segment_id', $segmentIds);
$query->findMany();
return $query->findMany();
}
public function __get($name) {
self::deprecationError($name);
$name = Helpers::camelCaseToUnderscore($name);
$value = parent::__get($name);
if ($name === 'filter_data' && $value !== null && WPFunctions::get()->isSerialized($value)) {
return unserialize($value);
}
return $value;
}
/**
* @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 deleteAllBySegmentIds($segmentIds) {
self::deprecationError(__METHOD__);
if (empty($segmentIds)) return;
$query = self::tableAlias('filters')
->whereIn('segment_id', $segmentIds);
$query->deleteMany();
}
private static function deprecationError($methodName) {
trigger_error(' Calling ' . esc_html($methodName) . ' is deprecated and will be removed. Use \MailPoet\Segments\DynamicSegments\DynamicSegmentFilterRepository and respective Doctrine entities instead.', E_USER_DEPRECATED);
}
}

View File

@@ -1,38 +0,0 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
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);
}
}

View File

@@ -1,41 +0,0 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Models;
/**
* @property int $newsletterId
* @property int $subscriberId
* @property int $queueId
* @property int $linkId
* @property int $count
*
* @deprecated This model is deprecated. Use \MailPoet\Statistics\StatisticsClicksRepository and
* \MailPoet\Entities\StatisticsClickEntity
* This class can be removed after 2022-11-04.
*/
class StatisticsClicks extends Model {
public static $_table = MP_STATISTICS_CLICKS_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);
}
private static function deprecationError($methodName) {
trigger_error(
'Calling ' . esc_html($methodName) . ' is deprecated and will be removed. Use \MailPoet\Statistics\StatisticsClicksRepository and \MailPoet\Entities\StatisticsClickEntity.',
E_USER_DEPRECATED
);
}
}

View File

@@ -1,55 +0,0 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Models;
/**
* @property int $newsletterId
* @property int $subscriberId
* @property int $queueId
* @deprecated This model is deprecated. Use \MailPoet\Statistics\StatisticsOpensRepository and
* \MailPoet\Entities\StatisticsOpenEntity
* This class can be removed after 2022-11-04.
*/
class StatisticsOpens extends Model {
public static $_table = MP_STATISTICS_OPENS_TABLE; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public static function getOrCreate($subscriberId, $newsletterId, $queueId) {
self::deprecationError(__METHOD__);
$statistics = self::where('subscriber_id', $subscriberId)
->where('newsletter_id', $newsletterId)
->where('queue_id', $queueId)
->findOne();
if (!$statistics) {
$statistics = self::create();
$statistics->subscriberId = $subscriberId;
$statistics->newsletterId = $newsletterId;
$statistics->queueId = $queueId;
$statistics->save();
}
return $statistics;
}
/**
* @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);
}
private static function deprecationError($methodName) {
trigger_error(
'Calling ' . esc_html($methodName) . ' is deprecated and will be removed. Use \MailPoet\Statistics\StatisticsOpensRepository and \MailPoet\Entities\StatisticsOpenEntity.',
E_USER_DEPRECATED
);
}
}

View File

@@ -1,42 +0,0 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Models;
/**
* @property int $newsletterId
* @property int $subscriberId
* @property int $queueId
* @property int $clickId
* @property int $orderId
* @property string $orderCurrency
* @property float $orderPriceTotal
* @deprecated This model is deprecated. Use \MailPoet\Statistics\StatisticsWooCommercePurchasesRepository
* and \MailPoet\Entities\StatisticsWooCommercePurchaseEntity
* This class can be removed after 2022-11-04.
*/
class StatisticsWooCommercePurchases extends Model {
public static $_table = MP_STATISTICS_WOOCOMMERCE_PURCHASES_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);
}
private static function deprecationError($methodName) {
trigger_error(
'Calling ' . esc_html($methodName) . ' is deprecated and will be removed. Use \MailPoet\Statistics\StatisticsWooCommercePurchasesRepository and \MailPoet\Entities\StatisticsWooCommercePurchaseEntity.',
E_USER_DEPRECATED
);
}
}

View File

@@ -310,11 +310,6 @@ parameters:
count: 1
path: ../../lib/Listing/ListingRepository.php
-
message: "#^Method MailPoet\\\\Models\\\\DynamicSegmentFilter\\:\\:__get\\(\\) should return string\\|null but returns mixed\\.$#"
count: 1
path: ../../lib/Models/DynamicSegmentFilter.php
-
message: "#^Parameter \\#2 \\$array of function implode expects array\\<string\\>, array\\<array\\<int, mixed\\>\\|string\\> given\\.$#"
count: 1

View File

@@ -310,11 +310,6 @@ parameters:
count: 1
path: ../../lib/Listing/ListingRepository.php
-
message: "#^Method MailPoet\\\\Models\\\\DynamicSegmentFilter\\:\\:__get\\(\\) should return string\\|null but returns mixed\\.$#"
count: 1
path: ../../lib/Models/DynamicSegmentFilter.php
-
message: "#^Parameter \\#2 \\$array of function implode expects array\\<string\\>, array\\<array\\<int, mixed\\>\\|string\\> given\\.$#"
count: 1

View File

@@ -309,11 +309,6 @@ parameters:
count: 1
path: ../../lib/Listing/ListingRepository.php
-
message: "#^Method MailPoet\\\\Models\\\\DynamicSegmentFilter\\:\\:__get\\(\\) should return string\\|null but returns mixed\\.$#"
count: 1
path: ../../lib/Models/DynamicSegmentFilter.php
-
message: "#^Parameter \\#2 \\$array of function implode expects array\\<string\\>, array\\<array\\<int, mixed\\>\\|string\\> given\\.$#"
count: 1