PHP Class Scalr\Model\Entity\Farm

Author: N.V.
Inheritance: extends Scalr\Model\AbstractEntity, implements Scalr\DataType\AccessPermissionsInterface
Afficher le fichier Open project: scalr/scalr Class Usage Examples

Méthodes publiques

Свойство Type Description
$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 Properties

Свойство Type Description
$_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.

Méthodes publiques

Méthode Description
__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

Method Details

__clone() public méthode

Reset farm id on clone
public __clone ( )

__get() public méthode

Gets the values of the properties that require initialization.
public __get ( string $name ) : mixed
$name string Name of property that is accessed
Résultat mixed Returns property value

appendTeams() public méthode

Appends Teams list
public appendTeams ( Team $team ) : Farm
$team Scalr\Model\Entity\Account\Team The Team entity
Résultat Farm

checkLocked() public méthode

Checks if farm is locked
public checkLocked ( )

cloneFarm() public méthode

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
Résultat Farm Returns clone

delete() public méthode

See also: AbstractEntity::delete()
public delete ( )

deleteScheduled() public méthode

Delete scheduled tasks
public deleteScheduled ( )

findWithTeams() public static méthode

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
Résultat Scalr\Model\Collections\ArrayCollection | Farm[] Returns collection of the entities.

getEnvironment() public méthode

Return Environment entity
public getEnvironment ( ) : Environment | null
Résultat Scalr\Model\Entity\Account\Environment | null

getStatusName() public static méthode

Translates status codes to status names
public static getStatusName ( integer $status ) : string
$status integer Status code
Résultat string Status name

getTeams() public méthode

Gets the list of the Teams which own the Farm
public getTeams ( ) : EntityIterator | Team[]
Résultat Scalr\Model\Collections\EntityIterator | Scalr\Model\Entity\Account\Team[]

getUserTeamOwnershipSql() public static méthode

... 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
Résultat string

hasAccessPermissions() public méthode

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.
Résultat boolean

hasUserTeamOwnership() public méthode

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
Résultat boolean

isTeamsChanged() public méthode

Checks whether the set of the Teams associated with the Farm has been changed.
public isTeamsChanged ( ) : boolean
Résultat boolean Returns true if the set of the Teams that is associated with the Farm has been changed

launch() public méthode

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
Résultat Farm

lock() public méthode

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])
Résultat Farm

save() public méthode

See also: AbstractEntity::save()
public save ( )

saveTeams() public méthode

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() public méthode

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() public méthode

Unlocks this farm
public unlock ( User $user ) : Farm
$user Scalr\Model\Entity\Account\User The User on whose behalf the lock unset
Résultat Farm

Property Details

$_environment protected_oe property

protected Environment,Scalr\Model\Entity\Account $_environment
Résultat Scalr\Model\Entity\Account\Environment

$_farmRoles protected_oe property

Farm roles collection
protected EntityIterator,Scalr\Model\Collections|FarmRole[],Scalr\Model\Entity $_farmRoles
Résultat Scalr\Model\Collections\EntityIterator | FarmRole[]

$_servers protected_oe property

Servers collection
protected EntityIterator,Scalr\Model\Collections|Server[],Scalr\Model\Entity $_servers
Résultat Scalr\Model\Collections\EntityIterator | Server[]

$_settings protected_oe property

Farm settings collection
protected SettingsCollection,Scalr\Model\Collections $_settings
Résultat Scalr\Model\Collections\SettingsCollection

$_teams protected_oe property

The Farm teams
protected EntityIterator,Scalr\Model\Collections|Team[],Scalr\Model\Entity\Account $_teams
Résultat Scalr\Model\Collections\EntityIterator | Scalr\Model\Entity\Account\Team[]

$_teamsChanged protected_oe property

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
Résultat boolean

$accountId public_oe property

Account Id
public int $accountId
Résultat integer

$added public_oe property

Added time
public DateTime $added
Résultat DateTime

$changed public_oe property

Last change time TODO: convert to DateTime with MySQL 5.6
public string $changed
Résultat string

$changedById public_oe property

Last editor Id
public int $changedById
Résultat integer

$comments public_oe property

Comments
public string $comments
Résultat string

$createdByEmail public_oe property

Creator E-Mail
public string $createdByEmail
Résultat string

$envId public_oe property

Environment Id
public int $envId
Résultat integer

$hash public_oe property

Hash
public string $hash
Résultat string

$id public_oe property

Identifier
public int $id
Résultat integer

$isCompleted public_oe property

Completion status
public bool $isCompleted
Résultat boolean

$launchOrder public_oe property

Launch order type
public bool $launchOrder
Résultat boolean

$launched public_oe property

Launched time
public DateTime $launched
Résultat DateTime

$name public_oe property

Farm name
public string $name
Résultat string

$ownerId public_oe property

Creator Id
public int $ownerId
Résultat integer

$region public_oe property

Region name
public string $region
Résultat string

$status public_oe property

Status
public int $status
Résultat integer

$termOnSyncFail public_oe property

Synchronization fail flag
public bool $termOnSyncFail
Résultat boolean