diff --git a/lib/Models/Model.php b/lib/Models/Model.php index d99d934cd2..fb89654fe0 100644 --- a/lib/Models/Model.php +++ b/lib/Models/Model.php @@ -19,16 +19,23 @@ if(!defined('ABSPATH')) exit; * @method array getConnectionNames() * @method $this useIdColumn($id_column) * @method \ORM|bool findOne($id=null) + * @method static \ORM|bool findOne($id=null) * @method array|\IdiormResultSet findMany() + * @method static array|\IdiormResultSet findMany() * @method \IdiormResultSet findResultSet() * @method array findArray() + * @method static array findArray() * @method $this forceAllDirty() * @method $this rawQuery($query, $parameters = array()) + * @method static $this rawQuery($query, $parameters = array()) * @method $this tableAlias($alias) * @method int countNullIdColumns() * @method $this select($column, $alias=null) + * @method static $this select($column, $alias=null) * @method $this selectExpr($expr, $alias=null) - * @method \ORM selectMany($values) + * @method static $this selectExpr($expr, $alias=null) + * @method \ORM selectMany($values,...) + * @method static \ORM selectMany($values,...) * @method \ORM selectManyExpr($values) * @method $this rawJoin($table, $constraint, $table_alias, $parameters = array()) * @method $this innerJoin($table, $constraint, $table_alias=null) @@ -36,11 +43,15 @@ if(!defined('ABSPATH')) exit; * @method $this rightOuterJoin($table, $constraint, $table_alias=null) * @method $this fullOuterJoin($table, $constraint, $table_alias=null) * @method $this where($column_name, $value=null) + * @method static $this where($column_name, $value=null) * @method $this whereEqual($column_name, $value=null) + * @method static $this whereEqual($column_name, $value=null) * @method $this whereNotEqual($column_name, $value=null) + * @method static $this whereNotEqual($column_name, $value=null) * @method $this whereIdIs($id) * @method $this whereAnyIs($values, $operator='=') * @method array|string whereIdIn($ids) + * @method static array|string whereIdIn($ids) * @method $this whereLike($column_name, $value=null) * @method $this whereNotLike($column_name, $value=null) * @method $this whereGt($column_name, $value=null) @@ -48,13 +59,19 @@ if(!defined('ABSPATH')) exit; * @method $this whereGte($column_name, $value=null) * @method $this whereLte($column_name, $value=null) * @method $this whereIn($column_name, $values) + * @method static $this whereIn($column_name, $values) * @method $this whereNotIn($column_name, $values) * @method $this whereNull($column_name) + * @method static $this whereNull($column_name) * @method $this whereNotNull($column_name) + * @method static $this whereNotNull($column_name) * @method $this whereRaw($clause, $parameters=array()) + * @method static $this whereRaw($clause, $parameters=array()) * @method $this deleteMany() * @method $this orderByDesc($column_name) + * @method static $this orderByDesc($column_name) * @method $this orderByAsc($column_name) + * @method static $this orderByAsc($column_name) * @method $this orderByExpr($clause) * @method $this groupBy($column_name) * @method $this groupByExpr($expr) @@ -76,6 +93,7 @@ if(!defined('ABSPATH')) exit; * @method bool setExpr($key, $value = null) * @method bool isDirty($key) * @method $this table_alias($alias) + * @method static $this table_alias($alias) */ class Model extends \Sudzy\ValidModel { const DUPLICATE_RECORD = 23000; diff --git a/lib/Models/Subscriber.php b/lib/Models/Subscriber.php index 0f1c088329..3c8828b1eb 100644 --- a/lib/Models/Subscriber.php +++ b/lib/Models/Subscriber.php @@ -513,7 +513,7 @@ class Subscriber extends Model { $custom_field_ids = array_keys($custom_fields_data); // get custom fields - $custom_fields = CustomField::findMany($custom_field_ids); + $custom_fields = CustomField::whereIdIn($custom_field_ids)->findMany(); foreach($custom_fields as $custom_field) { $value = (isset($custom_fields_data[$custom_field->id]) diff --git a/tasks/phpstan/phpstan.neon b/tasks/phpstan/phpstan.neon index f189c1fce2..d4e3511589 100644 --- a/tasks/phpstan/phpstan.neon +++ b/tasks/phpstan/phpstan.neon @@ -2,6 +2,5 @@ parameters: tmpDir: ../../temp/phpstan bootstrap: bootstrap.php ignoreErrors: - - '#Static call to instance method MailPoet\\Models\\Model::#' - '#Function members_register_.+ not found#' - '#MailPoet\\Premium\\DI\\ContainerConfigurator not found#' # this class is not available when premium is not active