Rewrite UserFlag entity to Doctrine

[MAILPOET-2014]
This commit is contained in:
Jan Jakeš
2019-07-04 11:24:06 +02:00
committed by M. Shull
parent 7105c8ad5b
commit c71bf4833c
9 changed files with 212 additions and 141 deletions

View File

@@ -1,24 +0,0 @@
<?php
namespace MailPoet\Models;
if (!defined('ABSPATH')) exit;
/**
* @property int $user_id
* @property string $name
* @property string $value
*/
class UserFlag extends Model {
public static $_table = MP_USER_FLAGS_TABLE;
public static function createOrUpdate($data = []) {
$keys = false;
if (!empty($data['user_id']) && !empty($data['name'])) {
$keys = [
'user_id' => $data['user_id'],
'name' => $data['name'],
];
}
return parent::_createOrUpdate($data, $keys);
}
}