Documentation

Organization extends AuthenticationObject
in package
Uses RetrievalTrait, HandleTrait

Table of Contents

$dbExpression  : array<string|int, mixed>
$dbTable  : string
$data  : array<string|int, mixed>|null
$permissionChanged  : bool
Process-wide flag indicating that permission-related data has changed.
$id  : int|null
__construct()  : mixed
add()  : Organization
all()  : array<string|int, object>
Get a list of permission objects (user or role)
byId()  : object|null
Get a permission object (user or role) by its id
byIds()  : array<string|int, object>
Get a list of permission objects (user or role) by their ids
byName()  : array<string|int, Organization>
Get all active organizations matching the given name.
byUser()  : Organization|null
Get the organization a given user belongs to.
checkInstance()  : mixed
clearFields()  : void
getAll()  : array<string|int, mixed>
getField()  : mixed
getGroup()  : Group|null
getUsers()  : array<string|int, mixed>
id()  : mixed
loadObject()  : mixed
name()  : string
nullId()  : mixed
refresh()  : void
Refresh the current permission object (user or role) by clearing all its fields and setting them new
refreshGroup()  : void
refreshUsers()  : void
remove()  : void
updateName()  : void
setField()  : void

Properties

$dbExpression

public static array<string|int, mixed> $dbExpression = []

$dbTable

public static string $dbTable = "z_organization"

$data

protected array<string|int, mixed>|null $data = null

The data of the authentication object

$permissionChanged

Process-wide flag indicating that permission-related data has changed.

protected static bool $permissionChanged = false

Declared once on the base class (and never redeclared in the trait or subclasses) so that User, Role and Group all share a single storage slot. When true, cached permissions are reloaded on each access, regardless of which authentication object triggered the change.

Methods

__construct()

public __construct(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>
Return values
mixed

add()

public static add(string|null $name[, bool $createGroup = false ][, string|null $groupName = null ]) : Organization
Parameters
$name : string|null
$createGroup : bool = false
$groupName : string|null = null
Return values
Organization

all()

Get a list of permission objects (user or role)

public static all() : array<string|int, object>
Return values
array<string|int, object>

byId()

Get a permission object (user or role) by its id

public static byId(int|string $id) : object|null
Parameters
$id : int|string

the id of the object

Return values
object|null

the permission object if found, null otherwise

byIds()

Get a list of permission objects (user or role) by their ids

public static byIds(int ...$ids) : array<string|int, object>
Parameters
$ids : int

The ids of the objects to retrieve

Return values
array<string|int, object>

The list of permission objects

byName()

Get all active organizations matching the given name.

public static byName(string $name) : array<string|int, Organization>

Organization names are not unique, so this returns an array - possibly empty, possibly containing multiple organizations sharing the same name.

Parameters
$name : string

The name to match exactly

Return values
array<string|int, Organization>

All active organizations with the given name

byUser()

Get the organization a given user belongs to.

public static byUser(User $user) : Organization|null

Convenience pass-through to User::organization() so callers can use the symmetric Organization::byUser($user) style alongside other by* retrievers.

Parameters
$user : User

The user to look up

Return values
Organization|null

The organization or null if the user has none

getAll()

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

getField()

public getField(string $field) : mixed
Parameters
$field : string
Return values
mixed

getUsers()

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

loadObject()

public loadObject(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>
Return values
mixed

refresh()

Refresh the current permission object (user or role) by clearing all its fields and setting them new

public refresh() : void
Tags
throws
RuntimeException

If the object no longer exists

Return values
void

refreshGroup()

public refreshGroup() : void
Return values
void

refreshUsers()

public refreshUsers() : void
Return values
void

updateName()

public updateName(string $name) : void
Parameters
$name : string
Return values
void

setField()

protected setField(string $field, mixed $value) : void
Parameters
$field : string
$value : mixed
Return values
void

Search results