PHP Класс Scalr\Model\Entity\Farm

Автор: N.V.
Наследование: extends Scalr\Model\AbstractEntity, implements Scalr\DataType\AccessPermissionsInterface
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$accountId integer Account Id
$added DateTime Added time
$changed string Last change time TODO: convert to DateTime with MySQL 5.6
$changedById integer Last editor Id
$comments string Comments
$createdByEmail string Creator E-Mail
$envId integer Environment Id
$hash string Hash
$id integer Identifier
$isCompleted boolean Completion status
$launchOrder boolean Launch order type
$launched DateTime Launched time
$name string Farm name
$ownerId integer Creator Id
$region string Region name
$status integer Status
$termOnSyncFail boolean Synchronization fail flag

Защищенные свойства (Protected)

Свойство Тип Описание
$_environment Scalr\Model\Entity\Account\Environment
$_farmRoles Scalr\Model\Collections\EntityIterator | FarmRole[] Farm roles collection
$_servers Scalr\Model\Collections\EntityIterator | Server[] Servers collection
$_settings Scalr\Model\Collections\SettingsCollection Farm settings collection
$_teams Scalr\Model\Collections\EntityIterator | Scalr\Model\Entity\Account\Team[] The Farm teams
$_teamsChanged boolean True value indicates that the set of the Teams associated with the Farm has been changed within the object with respect to database.

Открытые методы

Метод Описание
__clone ( ) Reset farm id on clone
__get ( string $name ) : mixed Magic getter.
appendTeams ( Team $team ) : Farm Appends Teams list
checkLocked ( ) Checks if farm is locked
cloneFarm ( string $name, User $user ) : Farm Creates clone for the farm TODO: refactor farms cloning
delete ( )
deleteScheduled ( ) Delete scheduled tasks
findWithTeams ( array $criteria = null, array $group = null, array $order = null, integer $limit = null, integer $offset = null, boolean $countRecords = null ) : ArrayCollection | Farm[] Searches farms by criteria and selecting and initiating their Teams
getEnvironment ( ) : Environment | null Return Environment entity
getStatusName ( integer $status ) : string Translates status codes to status names
getTeams ( ) : EntityIterator | Team[] Gets the list of the Teams which own the Farm
getUserTeamOwnershipSql ( integer $userId, integer $farmId = null ) : string Generate SQL query like "EXISTS(SELECT 1 FROM farm_teams .
hasAccessPermissions ( User $user, Environment $environment = null, string | boolean $modify = null ) : boolean
hasUserTeamOwnership ( User $user ) : boolean Check if given user belongs to team, which has access to farm
isTeamsChanged ( ) : boolean Checks whether the set of the Teams associated with the Farm has been changed.
launch ( User $user = null, array $auditLogExtra = null ) : Farm Launch this farm
lock ( User $user, string $comment, boolean $restrict = false ) : Farm Locks this farm
save ( )
saveTeams ( EntityIterator | Team[] $teams ) Associates a Farm with specified Teams.
setTeams ( EntityIterator | Team[] $teams ) Sets the list of the Teams which own the Farm
unlock ( User $user ) : Farm Unlocks this farm

Описание методов

__clone() публичный Метод

Reset farm id on clone
public __clone ( )

__get() публичный Метод

Gets the values of the properties that require initialization.
public __get ( string $name ) : mixed
$name string Name of property that is accessed
Результат mixed Returns property value

appendTeams() публичный Метод

Appends Teams list
public appendTeams ( Team $team ) : Farm
$team Scalr\Model\Entity\Account\Team The Team entity
Результат Farm

checkLocked() публичный Метод

Checks if farm is locked
public checkLocked ( )

cloneFarm() публичный Метод

Creates clone for the farm TODO: refactor farms cloning
public cloneFarm ( string $name, User $user ) : Farm
$name string The name of a new Farm
$user Scalr\Model\Entity\Account\User The User that initiates cloning
Результат Farm Returns clone

delete() публичный Метод

См. также: AbstractEntity::delete()
public delete ( )

deleteScheduled() публичный Метод

Delete scheduled tasks
public deleteScheduled ( )

findWithTeams() публичный статический Метод

Searches farms by criteria and selecting and initiating their Teams
public static findWithTeams ( array $criteria = null, array $group = null, array $order = null, integer $limit = null, integer $offset = null, boolean $countRecords = null ) : ArrayCollection | Farm[]
$criteria array optional The search criteria.
$group array optional The group by looks like [property1, ...], by default groups by `id`
$order array optional The results order looks like [property1 => true|false, ... ]
$limit integer optional The records limit
$offset integer optional The offset
$countRecords boolean optional True to calculate total number of the records without limit
Результат Scalr\Model\Collections\ArrayCollection | Farm[] Returns collection of the entities.

getEnvironment() публичный Метод

Return Environment entity
public getEnvironment ( ) : Environment | null
Результат Scalr\Model\Entity\Account\Environment | null

getStatusName() публичный статический Метод

Translates status codes to status names
public static getStatusName ( integer $status ) : string
$status integer Status code
Результат string Status name

getTeams() публичный Метод

Gets the list of the Teams which own the Farm
public getTeams ( ) : EntityIterator | Team[]
Результат Scalr\Model\Collections\EntityIterator | Scalr\Model\Entity\Account\Team[]

getUserTeamOwnershipSql() публичный статический Метод

... WHERE ...) to check FARM_TEAMS permission. Table farms should have alias f. If farmId is set, when JOIN table farms to get envId from it.
public static getUserTeamOwnershipSql ( integer $userId, integer $farmId = null ) : string
$userId integer Identifier of User
$farmId integer optional Identifier of Farm
Результат string

hasAccessPermissions() публичный Метод

public hasAccessPermissions ( User $user, Environment $environment = null, string | boolean $modify = null ) : boolean
$user Scalr\Model\Entity\Account\User The User Entity
$environment Scalr\Model\Entity\Account\Environment optional The Environment Entity
$modify string | boolean optional ACL Permission Identifier or boolean flag whether it should check modify permissions or not.
Результат boolean

hasUserTeamOwnership() публичный Метод

Check if given user belongs to team, which has access to farm
public hasUserTeamOwnership ( User $user ) : boolean
$user Scalr\Model\Entity\Account\User User entity
Результат boolean

isTeamsChanged() публичный Метод

Checks whether the set of the Teams associated with the Farm has been changed.
public isTeamsChanged ( ) : boolean
Результат boolean Returns true if the set of the Teams that is associated with the Farm has been changed

launch() публичный Метод

Launch this farm
public launch ( User $user = null, array $auditLogExtra = null ) : Farm
$user Scalr\Model\Entity\Account\User optional The user who initiates Farm launch
$auditLogExtra array optional Audit log extra fields to record
Результат Farm

lock() публичный Метод

Locks this farm
public lock ( User $user, string $comment, boolean $restrict = false ) : Farm
$user Scalr\Model\Entity\Account\User The User on whose behalf the lock set
$comment string Comment describing the reason and/or purpose of the lock
$restrict boolean optional Strict lock flag (I have no idea what that means [author's note])
Результат Farm

save() публичный Метод

См. также: AbstractEntity::save()
public save ( )

saveTeams() публичный Метод

This method should only be called within a transaction.
public saveTeams ( EntityIterator | Team[] $teams )
$teams Scalr\Model\Collections\EntityIterator | Scalr\Model\Entity\Account\Team[] Collection of the Teams

setTeams() публичный Метод

Sets the list of the Teams which own the Farm
public setTeams ( EntityIterator | Team[] $teams )
$teams Scalr\Model\Collections\EntityIterator | Scalr\Model\Entity\Account\Team[] The list of the Teams that which own the Farm

unlock() публичный Метод

Unlocks this farm
public unlock ( User $user ) : Farm
$user Scalr\Model\Entity\Account\User The User on whose behalf the lock unset
Результат Farm

Описание свойств

$_environment защищенное свойство

protected Environment,Scalr\Model\Entity\Account $_environment
Результат Scalr\Model\Entity\Account\Environment

$_farmRoles защищенное свойство

Farm roles collection
protected EntityIterator,Scalr\Model\Collections|FarmRole[],Scalr\Model\Entity $_farmRoles
Результат Scalr\Model\Collections\EntityIterator | FarmRole[]

$_servers защищенное свойство

Servers collection
protected EntityIterator,Scalr\Model\Collections|Server[],Scalr\Model\Entity $_servers
Результат Scalr\Model\Collections\EntityIterator | Server[]

$_settings защищенное свойство

Farm settings collection
protected SettingsCollection,Scalr\Model\Collections $_settings
Результат Scalr\Model\Collections\SettingsCollection

$_teams защищенное свойство

The Farm teams
protected EntityIterator,Scalr\Model\Collections|Team[],Scalr\Model\Entity\Account $_teams
Результат Scalr\Model\Collections\EntityIterator | Scalr\Model\Entity\Account\Team[]

$_teamsChanged защищенное свойство

True value indicates that the set of the Teams associated with the Farm has been changed within the object with respect to database.
protected bool $_teamsChanged
Результат boolean

$accountId публичное свойство

Account Id
public int $accountId
Результат integer

$added публичное свойство

Added time
public DateTime $added
Результат DateTime

$changed публичное свойство

Last change time TODO: convert to DateTime with MySQL 5.6
public string $changed
Результат string

$changedById публичное свойство

Last editor Id
public int $changedById
Результат integer

$comments публичное свойство

Comments
public string $comments
Результат string

$createdByEmail публичное свойство

Creator E-Mail
public string $createdByEmail
Результат string

$envId публичное свойство

Environment Id
public int $envId
Результат integer

$hash публичное свойство

Hash
public string $hash
Результат string

$id публичное свойство

Identifier
public int $id
Результат integer

$isCompleted публичное свойство

Completion status
public bool $isCompleted
Результат boolean

$launchOrder публичное свойство

Launch order type
public bool $launchOrder
Результат boolean

$launched публичное свойство

Launched time
public DateTime $launched
Результат DateTime

$name публичное свойство

Farm name
public string $name
Результат string

$ownerId публичное свойство

Creator Id
public int $ownerId
Результат integer

$region публичное свойство

Region name
public string $region
Результат string

$status публичное свойство

Status
public int $status
Результат integer

$termOnSyncFail публичное свойство

Synchronization fail flag
public bool $termOnSyncFail
Результат boolean