User
extends AccountModel
in package
User Model
Table of Contents
Properties
- $table_name : string|null
- $translators : array<string|int, mixed>
- $container : ContainerInterface
- $db_row : Row
- $is_first_save : bool
- $keyField : string|array<string|int, mixed>
- $loadedObjects : array<string|int, mixed>
- $roleObj : Role|null
- $sessionObj : UserSession|null
- $original_data : array<string|int, mixed>|null
Methods
- __call() : mixed
- {@inheritdoc}
- __construct() : mixed
- constructor
- __get() : mixed
- {@inheritdoc}
- __isset() : bool
- {@inheritdoc}
- __set() : void
- {@inheritdoc}
- __unset() : void
- {@inheritdoc}
- checkLoaded() : self
- ensures model is loaded
- checkPermission() : bool
- checks if user has permission
- containerCall() : mixed
- call method through container
- containerMake() : mixed
- create object through container
- current() : mixed
- {@inheritdoc}
- defaultTableName() : string
- gets model table name
- delete() : self
- removes model from db
- fill() : self
- fills empty model with data
- getAdditionalData() : string
- getApp() : App
- gets app object
- getApplicationLogger() : Manager
- gets application_logger service
- getAppRouteInfo() : RouteInfo|null
- gets route info
- getAppWebsite() : Website|null
- gets current website
- getAssets() : Manager
- gets assets manager
- getCache() : Manager
- get cache manager
- getChangedData() : array<string|int, mixed>|null
- gets model's changed data
- getCollection() : BaseCollection
- returns a Model collection
- getConfirmationCode() : string
- getContainer() : ContainerInterface
- gets container object
- getCreatedAt() : DateTime
- getCrudRouter() : Crud
- gets crud service
- getData() : mixed
- gets model's data
- getDb() : Database
- gets db object
- getDbRow() : Row
- getDebugbar() : StandardDebugBar
- gets debugbar object
- getDisplayName() : string
- getEmail() : string
- getEnv() : mixed
- gets env variable
- getEventManager() : SharedEventEmitter
- gets events manager service
- getGoogleAuthenticator() : PHPGangsta_GoogleAuthenticator
- gets google authenticator service
- getGuzzle() : Client
- gets guzzle service
- getHtmlRenderer() : HtmlPartsRenderer
- gets html renderer service
- getIcons() : Icons
- gets icons service
- getId() : int
- getImagine() : Imagine
- gets imagine service
- getIterator() : Traversable|ArrayIterator
- {@inheritdoc}
- getJWT() : string
- get JWT token
- getKeyField() : string|array<string|int, mixed>
- getKeyFieldValue() : mixed
- getLocale() : string
- getLocked() : int
- getLockedSince() : DateTime|null
- getLockedUntil() : DateTime|null
- getLog() : Logger
- gets log object
- getLoginTries() : int|null
- getMailer() : Mailer
- gets mailer service
- getNickname() : string
- getPassword() : string
- getPdo() : PDO
- gets PDO object
- getRedis() : Manager
- gets redis service
- getRegisteredSince() : string
- gets registered since
- getRequest() : Request
- gets current request object
- getRole() : Role
- gets user role
- getRoleId() : int
- getRouters() : array<string|int, mixed>
- gets routers
- getSchema() : Schema
- gets schema object
- getSearch() : Manager
- gets search service
- getSearchCollection() : BaseCollection
- returns a Model collection using SearchManager for finding elements
- getSesMailer() : SesClient
- gets SES mailer service
- getSiteData() : SiteData
- gets site data service
- getSmtpMailer() : Swift_Mailer
- gets SMTP mailer service
- getTableColumns() : mixed
- getTemplates() : Engine
- gets plates engine object
- getTranslator() : Translator
- gets translator
- getUpdatedAt() : DateTime
- getUser2Fa() : User2Fa|null
- getUsername() : string
- getUserSession() : UserSession
- getUtils() : Globals
- gets global utils service
- getWebhooksRouter() : Webhooks
- gets webhooks service
- getWebRouter() : Web
- gets routing service
- getZip() : Zip
- gets zip service
- hydrateStatementResult() : array<string|int, mixed>
- returns an array of models, starting from a statement Result
- incrementLoginTries() : User
- increments login_tries and eventually locks user
- isFirstSave() : bool
- is first save flag
- isLoaded() : bool
- checks if model is loaded
- isNew() : bool
- checks if model is new
- key() : mixed
- {@inheritdoc}
- load() : self
- loads model by id
- loadBy() : self
- loads model by field - value pair
- loadByCondition() : self|null
- loads model by condition
- lock() : self
- lock user
- new() : static
- gets new empty model
- next() : mixed
- {@inheritdoc}
- offsetExists() : bool
- {@inheritdoc}
- offsetGet() : mixed
- {@inheritdoc}
- offsetSet() : void
- {@inheritdoc}
- offsetUnset() : void
- {@inheritdoc}
- persist() : self
- saves model on db
- postLoad() : self
- post load hook
- postPersist() : self
- post persist hook
- postRemove() : self
- post remove hook
- prePersist() : self
- pre persist hook
- preRemove() : self
- pre remove hook
- remove() : self
- removes model from db
- requestUrl() : string|bool
- executes an http request
- reset() : self
- resets model
- rewind() : mixed
- {@inheritdoc}
- save() : self
- saves model on db
- select() : PDOStatement
- basic select statement
- setAdditionalData() : self
- setConfirmationCode() : self
- setCreatedAt() : self
- setData() : self
- sets model's data
- setDbRow() : self
- setEmail() : self
- setId() : self
- setIsFirstSave() : $this
- sets is first save flag
- setLocale() : self
- setLocked() : self
- setLockedSince() : self
- setLockedUntil() : self
- setLoginTries() : self
- setNickname() : self
- setPassword() : self
- setRole() : self
- sets user role
- setRoleId() : self
- setTableName() : self
- setUpdatedAt() : self
- setUsername() : self
- toJson() : string
- gets Model json rapresentation
- unlock() : self
- unlock user
- valid() : mixed
- {@inheritdoc}
- calcTokenId() : string
- calculates JWT token id
- getModelBasicWhere() : Result
- gets basic where statement for model
- getModelName() : string
- gets object model name
- getOriginalData() : mixed
- gets model's original data
- getService() : mixed
- gets registered service
- getTableName() : string
- gets table name
- loadedObjectsIdentifier() : string
- setOriginalData() : $this
- sets model's original data
- checkDbName() : self
- checks if Row object is from correct table
Properties
$table_name
public
string|null
$table_name
= null
table name
$translators
public
static array<string|int, mixed>
$translators
= []
translators
$container
protected
ContainerInterface
$container
$db_row
protected
Row
$db_row
database row
$is_first_save
protected
bool
$is_first_save
first save flag
$keyField
protected
static string|array<string|int, mixed>
$keyField
= 'id'
$loadedObjects
protected
static array<string|int, mixed>
$loadedObjects
= []
objects cache
$roleObj
protected
Role|null
$roleObj
= null
role object
$sessionObj
protected
UserSession|null
$sessionObj
= null
session object
$original_data
private
array<string|int, mixed>|null
$original_data
= null
original model data
Methods
__call()
{@inheritdoc}
public
__call(string $name, mixed $arguments) : mixed
Parameters
- $name : string
- $arguments : mixed
Tags
__construct()
constructor
public
__construct(ContainerInterface $container[, Row|null $db_row = null ]) : mixed
Parameters
- $container : ContainerInterface
- $db_row : Row|null = null
Tags
__get()
{@inheritdoc}
public
__get(mixed $key) : mixed
Parameters
- $key : mixed
__isset()
{@inheritdoc}
public
__isset(mixed $name) : bool
Parameters
- $name : mixed
Return values
bool__set()
{@inheritdoc}
public
__set(mixed $key, mixed $value) : void
Parameters
- $key : mixed
- $value : mixed
__unset()
{@inheritdoc}
public
__unset(mixed $name) : void
Parameters
- $name : mixed
checkLoaded()
ensures model is loaded
public
checkLoaded() : self
Tags
Return values
selfcheckPermission()
checks if user has permission
public
checkPermission(string $permission_name) : bool
Parameters
- $permission_name : string
Tags
Return values
boolcontainerCall()
call method through container
public
containerCall(callable $callable[, array<string|int, mixed> $arguments = [] ]) : mixed
Parameters
- $callable : callable
- $arguments : array<string|int, mixed> = []
containerMake()
create object through container
public
containerMake(string $className[, array<string|int, mixed> $arguments = [] ]) : mixed
Parameters
- $className : string
- $arguments : array<string|int, mixed> = []
current()
{@inheritdoc}
public
current() : mixed
defaultTableName()
gets model table name
public
static defaultTableName() : string
Return values
stringdelete()
removes model from db
public
delete() : self
Tags
Return values
selffill()
fills empty model with data
public
fill(int|Row $id) : self
Parameters
- $id : int|Row
Tags
Return values
selfgetAdditionalData()
public
getAdditionalData() : string
Return values
stringgetApp()
gets app object
public
getApp() : App
Tags
Return values
AppgetApplicationLogger()
gets application_logger service
public
getApplicationLogger() : Manager
Tags
Return values
ManagergetAppRouteInfo()
gets route info
public
getAppRouteInfo() : RouteInfo|null
Return values
RouteInfo|nullgetAppWebsite()
gets current website
public
getAppWebsite() : Website|null
Return values
Website|nullgetAssets()
gets assets manager
public
getAssets() : Manager
Tags
Return values
ManagergetCache()
get cache manager
public
getCache() : Manager
Tags
Return values
ManagergetChangedData()
gets model's changed data
public
getChangedData() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetCollection()
returns a Model collection
public
static getCollection() : BaseCollection
Return values
BaseCollectiongetConfirmationCode()
public
getConfirmationCode() : string
Return values
stringgetContainer()
gets container object
public
getContainer() : ContainerInterface
Return values
ContainerInterfacegetCreatedAt()
public
getCreatedAt() : DateTime
Return values
DateTimegetCrudRouter()
gets crud service
public
getCrudRouter() : Crud
Tags
Return values
CrudgetData()
gets model's data
public
getData([mixed|null $column = null ]) : mixed
Parameters
- $column : mixed|null = null
getDb()
gets db object
public
getDb() : Database
Tags
Return values
DatabasegetDbRow()
public
getDbRow() : Row
Return values
Row —database row
getDebugbar()
gets debugbar object
public
getDebugbar() : StandardDebugBar
Tags
Return values
StandardDebugBargetDisplayName()
public
getDisplayName() : string
Return values
stringgetEmail()
public
getEmail() : string
Return values
stringgetEnv()
gets env variable
public
getEnv(string $variable[, mixed $default = null ]) : mixed
Parameters
- $variable : string
- $default : mixed = null
Tags
getEventManager()
gets events manager service
public
getEventManager() : SharedEventEmitter
Tags
Return values
SharedEventEmittergetGoogleAuthenticator()
gets google authenticator service
public
getGoogleAuthenticator() : PHPGangsta_GoogleAuthenticator
Tags
Return values
PHPGangsta_GoogleAuthenticatorgetGuzzle()
gets guzzle service
public
getGuzzle() : Client
Tags
Return values
ClientgetHtmlRenderer()
gets html renderer service
public
getHtmlRenderer() : HtmlPartsRenderer
Tags
Return values
HtmlPartsRenderergetIcons()
gets icons service
public
getIcons() : Icons
Tags
Return values
IconsgetId()
public
getId() : int
Return values
intgetImagine()
gets imagine service
public
getImagine() : Imagine
Tags
Return values
ImaginegetIterator()
{@inheritdoc}
public
getIterator() : Traversable|ArrayIterator
Return values
Traversable|ArrayIteratorgetJWT()
get JWT token
public
getJWT([array<string|int, mixed> $extraData = [] ]) : string
Parameters
- $extraData : array<string|int, mixed> = []
Tags
Return values
stringgetKeyField()
public
static getKeyField() : string|array<string|int, mixed>
Return values
string|array<string|int, mixed>getKeyFieldValue()
public
getKeyFieldValue() : mixed
getLocale()
public
getLocale() : string
Return values
stringgetLocked()
public
getLocked() : int
Return values
intgetLockedSince()
public
getLockedSince() : DateTime|null
Return values
DateTime|nullgetLockedUntil()
public
getLockedUntil() : DateTime|null
Return values
DateTime|nullgetLog()
gets log object
public
getLog() : Logger
Tags
Return values
LoggergetLoginTries()
public
getLoginTries() : int|null
Return values
int|nullgetMailer()
gets mailer service
public
getMailer() : Mailer
Tags
Return values
MailergetNickname()
public
getNickname() : string
Return values
stringgetPassword()
public
getPassword() : string
Return values
stringgetPdo()
gets PDO object
public
getPdo() : PDO
Tags
Return values
PDOgetRedis()
gets redis service
public
getRedis() : Manager
Tags
Return values
ManagergetRegisteredSince()
gets registered since
public
getRegisteredSince() : string
Tags
Return values
stringgetRequest()
gets current request object
public
getRequest() : Request
Tags
Return values
RequestgetRole()
gets user role
public
getRole() : Role
Tags
Return values
RolegetRoleId()
public
getRoleId() : int
Return values
intgetRouters()
gets routers
public
getRouters() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getSchema()
gets schema object
public
getSchema() : Schema
Tags
Return values
SchemagetSearch()
gets search service
public
getSearch() : Manager
Tags
Return values
ManagergetSearchCollection()
returns a Model collection using SearchManager for finding elements
public
static getSearchCollection([array<string|int, mixed> $conditions = [] ]) : BaseCollection
Parameters
- $conditions : array<string|int, mixed> = []
Return values
BaseCollectiongetSesMailer()
gets SES mailer service
public
getSesMailer() : SesClient
Tags
Return values
SesClientgetSiteData()
gets site data service
public
getSiteData() : SiteData
Tags
Return values
SiteDatagetSmtpMailer()
gets SMTP mailer service
public
getSmtpMailer() : Swift_Mailer
Tags
Return values
Swift_MailergetTableColumns()
public
static getTableColumns([ContainerInterface|null $container = null ]) : mixed
Parameters
- $container : ContainerInterface|null = null
getTemplates()
gets plates engine object
public
getTemplates() : Engine
Tags
Return values
EnginegetTranslator()
gets translator
public
getTranslator([string|null $locale_code = null ]) : Translator
Parameters
- $locale_code : string|null = null
Tags
Return values
TranslatorgetUpdatedAt()
public
getUpdatedAt() : DateTime
Return values
DateTimegetUser2Fa()
public
getUser2Fa([int|null $websiteId = null ]) : User2Fa|null
Parameters
- $websiteId : int|null = null
Return values
User2Fa|nullgetUsername()
public
getUsername() : string
Return values
stringgetUserSession()
public
getUserSession() : UserSession
Tags
Return values
UserSessiongetUtils()
gets global utils service
public
getUtils() : Globals
Tags
Return values
GlobalsgetWebhooksRouter()
gets webhooks service
public
getWebhooksRouter() : Webhooks
Tags
Return values
WebhooksgetWebRouter()
gets routing service
public
getWebRouter() : Web
Tags
Return values
WebgetZip()
gets zip service
public
getZip() : Zip
Tags
Return values
ZiphydrateStatementResult()
returns an array of models, starting from a statement Result
public
static hydrateStatementResult(Result $stmt) : array<string|int, mixed>
Parameters
- $stmt : Result
Tags
Return values
array<string|int, mixed>incrementLoginTries()
increments login_tries and eventually locks user
public
incrementLoginTries() : User
Return values
UserisFirstSave()
is first save flag
public
isFirstSave() : bool
Return values
boolisLoaded()
checks if model is loaded
public
isLoaded() : bool
Return values
boolisNew()
checks if model is new
public
isNew() : bool
Return values
boolkey()
{@inheritdoc}
public
key() : mixed
load()
loads model by id
public
static load(mixed $id[, bool $reset = false ]) : self
Parameters
- $id : mixed
- $reset : bool = false
Return values
selfloadBy()
loads model by field - value pair
public
static loadBy(string $field, mixed $value) : self
Parameters
- $field : string
- $value : mixed
Tags
Return values
selfloadByCondition()
loads model by condition
public
static loadByCondition(array<string|int, mixed> $condition) : self|null
Parameters
- $condition : array<string|int, mixed>
Tags
Return values
self|nulllock()
lock user
public
lock([DateTime|null $until = null ]) : self
Parameters
- $until : DateTime|null = null
Return values
selfnew()
gets new empty model
public
static new([array<string|int, mixed> $initial_data = [] ]) : static
Parameters
- $initial_data : array<string|int, mixed> = []
Tags
Return values
staticnext()
{@inheritdoc}
public
next() : mixed
offsetExists()
{@inheritdoc}
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
{@inheritdoc}
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
offsetSet()
{@inheritdoc}
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
{@inheritdoc}
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
persist()
saves model on db
public
persist([bool $recursive = true ]) : self
Parameters
- $recursive : bool = true
Tags
Return values
selfpostLoad()
post load hook
public
postLoad() : self
Return values
selfpostPersist()
post persist hook
public
postPersist() : self
Return values
selfpostRemove()
post remove hook
public
postRemove() : self
Return values
selfprePersist()
pre persist hook
public
prePersist() : self
Return values
selfpreRemove()
pre remove hook
public
preRemove() : self
Return values
selfremove()
removes model from db
public
remove() : self
Tags
Return values
selfrequestUrl()
executes an http request
public
requestUrl(string $url[, string $method = 'GET' ][, array<string|int, mixed> $options = [] ]) : string|bool
Parameters
- $url : string
- $method : string = 'GET'
- $options : array<string|int, mixed> = []
Tags
Return values
string|boolreset()
resets model
public
reset() : self
Tags
Return values
selfrewind()
{@inheritdoc}
public
rewind() : mixed
save()
saves model on db
public
save() : self
Tags
Return values
selfselect()
basic select statement
public
static select([array<string|int, mixed> $options = [] ]) : PDOStatement
Parameters
- $options : array<string|int, mixed> = []
Return values
PDOStatementsetAdditionalData()
public
setAdditionalData(string $additional_data) : self
Parameters
- $additional_data : string
Return values
selfsetConfirmationCode()
public
setConfirmationCode(string $confirmation_code) : self
Parameters
- $confirmation_code : string
Return values
selfsetCreatedAt()
public
setCreatedAt(DateTime $created_at) : self
Parameters
- $created_at : DateTime
Return values
selfsetData()
sets model's data
public
setData(array<string|int, mixed> $data) : self
Parameters
- $data : array<string|int, mixed>
Return values
selfsetDbRow()
public
setDbRow(Row $db_row) : self
Parameters
- $db_row : Row
Return values
selfsetEmail()
public
setEmail(string $email) : self
Parameters
- $email : string
Return values
selfsetId()
public
setId(int $id) : self
Parameters
- $id : int
Return values
selfsetIsFirstSave()
sets is first save flag
public
setIsFirstSave(bool $is_first_save) : $this
Parameters
- $is_first_save : bool
Return values
$thissetLocale()
public
setLocale(string $locale) : self
Parameters
- $locale : string
Return values
selfsetLocked()
public
setLocked(int $locked) : self
Parameters
- $locked : int
Return values
selfsetLockedSince()
public
setLockedSince(DateTime|null $locked_since) : self
Parameters
- $locked_since : DateTime|null
Return values
selfsetLockedUntil()
public
setLockedUntil(DateTime|null $locked_until) : self
Parameters
- $locked_until : DateTime|null
Return values
selfsetLoginTries()
public
setLoginTries(int|null $login_tries) : self
Parameters
- $login_tries : int|null
Return values
selfsetNickname()
public
setNickname(string $nickname) : self
Parameters
- $nickname : string
Return values
selfsetPassword()
public
setPassword(string $password) : self
Parameters
- $password : string
Return values
selfsetRole()
sets user role
public
setRole(Role|int|string $role) : self
Parameters
- $role : Role|int|string
Return values
selfsetRoleId()
public
setRoleId(int $role_id) : self
Parameters
- $role_id : int
Return values
selfsetTableName()
public
setTableName(string $table_name) : self
Parameters
- $table_name : string
Return values
selfsetUpdatedAt()
public
setUpdatedAt(DateTime $updated_at) : self
Parameters
- $updated_at : DateTime
Return values
selfsetUsername()
public
setUsername(string $username) : self
Parameters
- $username : string
Return values
selftoJson()
gets Model json rapresentation
public
toJson([int $level = 0 ]) : string
Parameters
- $level : int = 0
-
internally used
Return values
stringunlock()
unlock user
public
unlock() : self
Return values
selfvalid()
{@inheritdoc}
public
valid() : mixed
calcTokenId()
calculates JWT token id
protected
calcTokenId() : string
Return values
stringgetModelBasicWhere()
gets basic where statement for model
protected
static getModelBasicWhere([array<string|int, mixed>|null $condition = [] ][, array<string|int, mixed> $order = [] ]) : Result
Parameters
- $condition : array<string|int, mixed>|null = []
- $order : array<string|int, mixed> = []
Return values
ResultgetModelName()
gets object model name
protected
getModelName() : string
Return values
stringgetOriginalData()
gets model's original data
protected
getOriginalData([mixed|null $key = null ]) : mixed
Parameters
- $key : mixed|null = null
getService()
gets registered service
protected
getService(string $service_key) : mixed
Parameters
- $service_key : string
Tags
getTableName()
gets table name
protected
getTableName() : string
Return values
stringloadedObjectsIdentifier()
protected
static loadedObjectsIdentifier(mixed $id) : string
Parameters
- $id : mixed
Return values
stringsetOriginalData()
sets model's original data
protected
setOriginalData(array<string|int, mixed>|null $original_data) : $this
Parameters
- $original_data : array<string|int, mixed>|null
Return values
$thischeckDbName()
checks if Row object is from correct table
private
checkDbName(Row $db_row) : self
Parameters
- $db_row : Row