Newer
Older
<?php
/**
* Copyright Maarch since 2008 under licence GPLv3.
* See LICENCE.txt file at the root folder for more details.
* This file is part of Maarch software.
*
*/
/**
* @brief User Model
* @author dev@maarch.org
* @ingroup core
*/
namespace Core\Models;
require_once 'apps/maarch_entreprise/services/Table.php';
class UserModelAbstract extends \Apps_Table_Service
{
public static function getByEmail(array $aArgs = [])
{
static::checkRequired($aArgs, ['mail']);
static::checkString($aArgs, ['mail']);
$aReturn = static::select([
'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
'table' => ['users'],
'where' => ['mail = ? and status = ?'],
'data' => [$aArgs['mail'], 'OK'],
'limit' => 1,
]);
return $aReturn;
}
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
public static function getById(array $aArgs = [])
{
static::checkRequired($aArgs, ['userId']);
static::checkString($aArgs, ['userId']);
$aReturn = static::select([
'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
'table' => ['users'],
'where' => ['user_id = ?'],
'data' => [$aArgs['userId']],
]);
return $aReturn[0];
}
public static function getSignaturesById(array $aArgs = [])
{
static::checkRequired($aArgs, ['userId']);
static::checkString($aArgs, ['userId']);
$aReturn = static::select([
'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
'table' => ['user_signatures'],
'where' => ['user_id = ?'],
'data' => [$aArgs['userId']],
]);
return $aReturn;
}
public static function getEmailSignaturesById(array $aArgs = [])
{
static::checkRequired($aArgs, ['userId']);
static::checkString($aArgs, ['userId']);
$aReturn = static::select([
'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
'table' => ['users_email_signatures'],
'where' => ['user_id = ?'],
'data' => [$aArgs['userId']],
]);
return $aReturn;
}