Office
extends BaseEntity
in package
Office Entity - Hierarchical office positions within departments
Represents individual officer positions with hierarchical relationships, warrant requirements, role assignments, and branch applicability constraints.
Tags
Table of Contents
Properties
- $applicable_branch_types : string|null
- $branch_id : int|null
- $branch_types : array<string|int, mixed>
- $can_skip_report : bool
- $created : DateTime
- $created_by : int|null
- $default_contact_address : string
- $deleted : Date|null
- $department : Department
- $department_id : int|null
- $department_name : string|null
- $deputies : array<string|int, Office>
- $deputy_to : Office
- $deputy_to_id : int|null
- $deputy_to_name : string|null
- $direct_reports : array<string|int, Office>
- $grants_role : Role
- $grants_role_id : int|null
- $grants_role_name : string|null
- $id : int
- $is_deputy : bool
- $modified : DateTime
- $modified_by : int|null
- $name : string
- $officers : array<string|int, Officer>
- $only_one_per_branch : bool
- $reports_to : Office
- $reports_to_id : int|null
- $reports_to_name : string|null
- $required_office : bool
- $requires_warrant : bool
- $term_length : int
- $_accessible : array<string, bool>
- Fields that can be mass assigned using newEntity() or patchEntity().
Methods
- getBranchId() : int|null
- Get the branch ID for authorization checks.
- _getBranchTypes() : array<string|int, mixed>
- Get branch types as an array from serialized storage.
- _getDepartmentName() : string|null
- _getDeputyToName() : string|null
- _getGrantsRoleName() : string|null
- _getIsDeputy() : bool
- Check if this office is a deputy to another office.
- _getReportsToName() : string|null
- _setBranchTypes() : void
- Set branch types from array or string, serialized for storage.
- _setDeputyToId() : int|null
- Set deputy_to_id and automatically set reports_to_id to maintain hierarchy.
- _setReportsToId() : int|null
- Set reports_to_id and clear deputy_to_id to prevent conflicts.
Properties
$applicable_branch_types
public
string|null
$applicable_branch_types
Serialized array of applicable branch types
$branch_id
public
int|null
$branch_id
Associated branch ID (when applicable)
$branch_types
public
array<string|int, mixed>
$branch_types
Virtual property for branch type array access
$can_skip_report
public
bool
$can_skip_report
Reporting exemption permission
$created
public
DateTime
$created
Record creation timestamp
$created_by
public
int|null
$created_by
User ID who created this record
$default_contact_address
public
string
$default_contact_address
Default email contact for the office
$deleted
public
Date|null
$deleted
Soft deletion timestamp
$department
public
Department
$department
Parent department
$department_id
public
int|null
$department_id
Foreign key to parent department
$department_name
public
string|null
$department_name
Virtual property for grid display
$deputies
public
array<string|int, Office>
$deputies
Child deputy offices
$deputy_to
public
Office
$deputy_to
Parent office for deputy relationships
$deputy_to_id
public
int|null
$deputy_to_id
Foreign key for deputy office relationships
$deputy_to_name
public
string|null
$deputy_to_name
Virtual property for grid display
$direct_reports
public
array<string|int, Office>
$direct_reports
Child offices in reporting hierarchy
$grants_role
public
Role
$grants_role
Role granted upon assignment
$grants_role_id
public
int|null
$grants_role_id
Foreign key to role granted upon assignment
$grants_role_name
public
string|null
$grants_role_name
Virtual property for grid display
$id
public
int
$id
Primary key
$is_deputy
public
bool
$is_deputy
Virtual property indicating deputy office status
$modified
public
DateTime
$modified
Last modification timestamp
$modified_by
public
int|null
$modified_by
User ID who last modified this record
$name
public
string
$name
Office title (unique, required)
$officers
public
array<string|int, Officer>
$officers
All officer assignments
$only_one_per_branch
public
bool
$only_one_per_branch
Branch-level uniqueness constraint
$reports_to
public
Office
$reports_to
Parent office for reporting hierarchy
$reports_to_id
public
int|null
$reports_to_id
Foreign key for reporting hierarchy
$reports_to_name
public
string|null
$reports_to_name
Virtual property for grid display
$required_office
public
bool
$required_office
Organizational requirement flag
$requires_warrant
public
bool
$requires_warrant
Warrant requirement flag
$term_length
public
int
$term_length
Duration in months for officer terms
$_accessible
Fields that can be mass assigned using newEntity() or patchEntity().
protected
array<string, bool>
$_accessible
= ['name' => true, 'department_id' => true, 'requires_warrant' => true, 'can_skip_report' => true, 'required_office' => true, 'only_one_per_branch' => true, 'deputy_to_id' => true, 'reports_to_id' => true, 'grants_role_id' => true, 'term_length' => true, 'deleted' => true, 'department' => true, 'officers' => true, 'branch_types' => true, 'default_contact_address' => true]
Methods
getBranchId()
Get the branch ID for authorization checks.
public
getBranchId() : int|null
Child classes should override for complex branch relationships.
Return values
int|null —The branch ID, or null if no association
_getBranchTypes()
Get branch types as an array from serialized storage.
protected
_getBranchTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>_getDepartmentName()
protected
_getDepartmentName() : string|null
Return values
string|null_getDeputyToName()
protected
_getDeputyToName() : string|null
Return values
string|null_getGrantsRoleName()
protected
_getGrantsRoleName() : string|null
Return values
string|null_getIsDeputy()
Check if this office is a deputy to another office.
protected
_getIsDeputy() : bool
Return values
bool_getReportsToName()
protected
_getReportsToName() : string|null
Return values
string|null_setBranchTypes()
Set branch types from array or string, serialized for storage.
protected
_setBranchTypes(array<string|int, mixed>|string $branchTypes) : void
Parameters
- $branchTypes : array<string|int, mixed>|string
-
Branch types to serialize
_setDeputyToId()
Set deputy_to_id and automatically set reports_to_id to maintain hierarchy.
protected
_setDeputyToId(int|null $deputy_to_id) : int|null
Parameters
- $deputy_to_id : int|null
-
The office ID this office is deputy to
Return values
int|null_setReportsToId()
Set reports_to_id and clear deputy_to_id to prevent conflicts.
protected
_setReportsToId(int|null $reports_to_id) : int|null
Parameters
- $reports_to_id : int|null
-
The office ID this office reports to