Magrathea PHP 2

AdminUser extends MagratheaModel
in package
implements iMagratheaModel

Class for installing Magrathea's Admin

Table of Contents

Interfaces

iMagratheaModel

Properties

$active  : mixed
$created_at  : mixed
$email  : mixed
$id  : mixed
$last_login  : mixed
$password  : mixed
$role_id  : mixed
$updated_at  : mixed
$autoLoad  : mixed
$autoload  : mixed
$dbAlias  : mixed
$dbPk  : mixed
$dbTable  : mixed
$dbValues  : mixed
$dirtyValues  : mixed
$relations  : mixed

Methods

__construct()  : mixed
__get()  : string
MAGIC FUNCTION: gets required property
__set()  : object|null
MAGIC FUNCTION: updates required property
__toString()  : string
To String! =)
Assign()  : MagratheaModel
Gets an array of whatever and assign it to the properties of model
CheckPassword()  : bool
Delete()  : bool
Deletes the object in database
Get()  : string
gets required property
GetAutoLoad()  : array<string|int, mixed>
Gets autoload objects
GetById()  : object|null
Returns object by Id. If null, creates a null instance of the object.
GetDataTypeFromField()  : mixed
Get (Magrathea) data type from field
GetDbTable()  : string
Gets table related to model
GetDbValues()  : array<string|int, mixed>
Gets array of table column values
GetFields()  : array<string|int, mixed>
Get fields from model
GetFieldsForSelect()  : string
Prepare fields for this model for a select statement
GetID()  : int|string
Gets id value
GetNextID()  : int
Gets the next auto increment id for this object
GetPkName()  : string
Gets PK Name
GetProperties()  : array<string|int, mixed>
Get all properties from model
GetRoleName()  : mixed
GetRoles()  : mixed
IncludeAllModels()  : mixed
Include all classes presents on `Models` folder
Insert()  : int
Inserts the object in database
IsAdmin()  : bool
checks if it's admin
IsEmpty()  : bool
Checks if the object exists (id not null)
LoadObjectFromTableRow()  : mixed
Receives an array with the columns and values and associates then internally into the object
ModelName()  : string
returns the name of the class without the namespace
PermissionCanEdit()  : bool
checks if the user can edit another user
Ref()  : string
returns a string for identifying the object in a relation
Save()  : int|bool
Saves: Using a insert if pk is not set and an update if pk is set Basically, Inserts if id does not exists and updates if id does exists
Set()  : object|null
Sets given property
SetPassword()  : AdminUser
Start()  : mixed
ToArray()  : mixed
ToJson()  : array<string|int, mixed>
Gets a Json
ToString()  : string
To String! =)
Update()  : bool
Updates the object in database
GetRelationId()  : int
When updating an object with a relation returns the relation ID or inserts it.

Properties

Methods

__construct()

public __construct([mixed $id = null ]) : mixed
Parameters
$id : mixed = null

__get()

MAGIC FUNCTION: gets required property

public __get(string $key) : string
Parameters
$key : string

property

Tags
throws
MagratheaModelException

if property does not exists into object

Return values
string

property value

__set()

MAGIC FUNCTION: updates required property

public __set(string $key, object $value) : object|null
Parameters
$key : string

property

$value : object

value

Tags
throws
MagratheaModelException

if property does not exists into object

Return values
object|null

property value

__toString()

To String! =)

public __toString() : string
Return values
string

Object.toString()

Assign()

Gets an array of whatever and assign it to the properties of model

public Assign(array<string|int, mixed> $data) : MagratheaModel
Parameters
$data : array<string|int, mixed>

data

Return values
MagratheaModel

itself

CheckPassword()

public CheckPassword(mixed $pwd) : bool
Parameters
$pwd : mixed
Return values
bool

Delete()

Deletes the object in database

public Delete() : bool
Return values
bool

successfully updated

Get()

gets required property

public Get(string $key[, bool $supressException = false ]) : string
Parameters
$key : string

property

$supressException : bool = false

if set to true, function will not throw Exception if property does not exist

Tags
throws
MagratheaModelException

if property does not exists into object

Return values
string

property value

GetAutoLoad()

Gets autoload objects

public GetAutoLoad() : array<string|int, mixed>
Return values
array<string|int, mixed>

auto load objects or null if none

GetById()

Returns object by Id. If null, creates a null instance of the object.

public GetById(int|string $id) : object|null

This will also load any related objects that are set as "autoload" internally. if an object with the given id can not be found, or any of the auto-load related objects can not be found an exception will be thrown.

Parameters
$id : int|string

id for the referred object

Tags
throws
MagratheaModelException

object could not be found

Return values
object|null

desired object

GetDataTypeFromField()

Get (Magrathea) data type from field

public static GetDataTypeFromField(string $field) : mixed
Parameters
$field : string

magrathea-related type

GetDbTable()

Gets table related to model

public GetDbTable() : string
Return values
string

model's table

GetDbValues()

Gets array of table column values

public GetDbValues() : array<string|int, mixed>
Return values
array<string|int, mixed>

model's columns

GetFields()

Get fields from model

public GetFields() : array<string|int, mixed>
Return values
array<string|int, mixed>

model's fields

GetFieldsForSelect()

Prepare fields for this model for a select statement

public GetFieldsForSelect() : string
Return values
string

fields for select clause built

GetID()

Gets id value

public GetID() : int|string
Return values
int|string

Id value

GetNextID()

Gets the next auto increment id for this object

public GetNextID() : int
Return values
int

next auto-increment value

GetPkName()

Gets PK Name

public GetPkName() : string
Return values
string

PK name column

GetProperties()

Get all properties from model

public GetProperties() : array<string|int, mixed>
Return values
array<string|int, mixed>

model's properties

IncludeAllModels()

Include all classes presents on `Models` folder

public static IncludeAllModels() : mixed

Insert()

Inserts the object in database

public Insert() : int
Return values
int

id of inserted object

IsAdmin()

checks if it's admin

public IsAdmin() : bool
Return values
bool

IsEmpty()

Checks if the object exists (id not null)

public IsEmpty() : bool
Return values
bool

does it?

LoadObjectFromTableRow()

Receives an array with the columns and values and associates then internally into the object

public LoadObjectFromTableRow(array<string|int, mixed> $row) : mixed
Parameters
$row : array<string|int, mixed>

mysql result for the object

ModelName()

returns the name of the class without the namespace

public ModelName() : string
Return values
string

PermissionCanEdit()

checks if the user can edit another user

public PermissionCanEdit() : bool
Return values
bool

Ref()

returns a string for identifying the object in a relation

public Ref() : string
Return values
string

Save()

Saves: Using a insert if pk is not set and an update if pk is set Basically, Inserts if id does not exists and updates if id does exists

public Save() : int|bool
Return values
int|bool

id if inserted and true if updated

Set()

Sets given property

public Set(string $key, mixed $value[, bool $supressException = false ]) : object|null
Parameters
$key : string

property

$value : mixed

value

$supressException : bool = false

if set to true, function will not throw Exception if property does not exist

Tags
throws
MagratheaModelException

if property does not exists into object

Return values
object|null

property value

ToJson()

Gets a Json

public ToJson() : array<string|int, mixed>
Return values
array<string|int, mixed>

json

ToString()

To String! =)

public ToString() : string
Return values
string

Object.toString()

Update()

Updates the object in database

public Update() : bool
Return values
bool

successfully updated

GetRelationId()

When updating an object with a relation returns the relation ID or inserts it.

private GetRelationId(mixed $obj) : int
Parameters
$obj : mixed
Return values
int

object id


        
On this page

Search results