PHP Class Scalr\Stats\CostAnalytics\Entity\ProjectEntity

Since: 5.0 (11.02.2014)
Author: Vitaliy Demidov ([email protected])
Inheritance: extends Scalr\Model\AbstractEntity, implements Scalr\DataType\AccessPermissionsInterface
Show file Open project: scalr/scalr Class Usage Examples

Public Properties

Property Type Description
$accountId integer Global by default
$archived boolean Whether the project has been archived
$ccId string Cost centre identifier (UUID)
$created DateTime The date the record was created on
$createdByEmail string Email address of the user who created record
$createdById integer Identifier of the user who created this project
$envId integer It's used only in combination with share type - 3
$name string The name of the cost centre
$projectId string Project identifier (UUID)
$shared integer Share type

Public Methods

Method Description
__construct ( ) Constructor
checkRemoval ( ) : boolean Checks whether project can be removed
delete ( )
getCostCenter ( ) : Scalr\Stats\CostAnalytics\Entity\CostCentreEntity Gets parent Cost Center
getFarmsList ( ) : array Get the list of the farms which are assigned to specified project
getProperties ( ) : ArrayCollection | null Gets all collection of the properties for this cost centre
getProperty ( string $name, boolean $ignoreCache = false ) : string | null Gets property with name
getQuarterlyBudget ( integer $year ) : ArrayCollection Gets quarterly budget of specified year for the Project
hasAccessPermissions ( $user, $environment = null, $modify = null )
loadProperties ( ) Loads all properties to entity
save ( )
saveProperty ( string $name, string $value ) : Scalr\Stats\CostAnalytics\Entity\CostCentreEntity Saves property
setCostCenter ( Scalr\Stats\CostAnalytics\Entity\CostCentreEntity $cc = null ) : ProjectEntity Sets a parent costcenter
setProperty ( string $name, string $value ) : Scalr\Stats\CostAnalytics\Entity\CostCentreEntity Sets property with specified name

Method Details

__construct() public method

Constructor
public __construct ( )

checkRemoval() public method

If Project can't be archived and removed it will throw an exception
public checkRemoval ( ) : boolean
return boolean Returns TRUE if Project can be removed or false if it can be archived or throws an exception otherwise

delete() public method

See also: Scalr\Model\AbstractEntity::delete()
public delete ( )

getCostCenter() public method

Gets parent Cost Center
public getCostCenter ( ) : Scalr\Stats\CostAnalytics\Entity\CostCentreEntity
return Scalr\Stats\CostAnalytics\Entity\CostCentreEntity Returns cost centre entity

getFarmsList() public method

Get the list of the farms which are assigned to specified project
public getFarmsList ( ) : array
return array Returns the array looks like [farm_id => name]

getProperties() public method

Gets all collection of the properties for this cost centre
public getProperties ( ) : ArrayCollection | null
return Scalr\Model\Collections\ArrayCollection | null

getProperty() public method

Gets property with name
public getProperty ( string $name, boolean $ignoreCache = false ) : string | null
$name string The name of the property
$ignoreCache boolean optional Should it ignore cache or not
return string | null Returns the property entity or null

getQuarterlyBudget() public method

Gets quarterly budget of specified year for the Project
public getQuarterlyBudget ( integer $year ) : ArrayCollection
$year integer The year
return Scalr\Model\Collections\ArrayCollection Returns collection of the QuarterlyBudgetEntity objects

hasAccessPermissions() public method

See also: AccessPermissionsInterface::hasAccessPermissions()
public hasAccessPermissions ( $user, $environment = null, $modify = null )

loadProperties() public method

Loads all properties to entity
public loadProperties ( )

save() public method

See also: Scalr\Model\AbstractEntity::save()
public save ( )

saveProperty() public method

It will immediately save specified record to database, so that cost centre must exist before you call this method.
public saveProperty ( string $name, string $value ) : Scalr\Stats\CostAnalytics\Entity\CostCentreEntity
$name string The unique name of the property
$value string The value of the property
return Scalr\Stats\CostAnalytics\Entity\CostCentreEntity

setCostCenter() public method

Sets a parent costcenter
public setCostCenter ( Scalr\Stats\CostAnalytics\Entity\CostCentreEntity $cc = null ) : ProjectEntity
$cc Scalr\Stats\CostAnalytics\Entity\CostCentreEntity
return ProjectEntity

setProperty() public method

Sets property with specified name
public setProperty ( string $name, string $value ) : Scalr\Stats\CostAnalytics\Entity\CostCentreEntity
$name string The unique name of the property
$value string The value of the property
return Scalr\Stats\CostAnalytics\Entity\CostCentreEntity

Property Details

$accountId public property

Global by default
public int $accountId
return integer

$archived public property

Whether the project has been archived
public bool $archived
return boolean

$ccId public property

Cost centre identifier (UUID)
public string $ccId
return string

$created public property

The date the record was created on
public DateTime $created
return DateTime

$createdByEmail public property

Email address of the user who created record
public string $createdByEmail
return string

$createdById public property

Identifier of the user who created this project
public int $createdById
return integer

$envId public property

It's used only in combination with share type - 3
public int $envId
return integer

$name public property

The name of the cost centre
public string $name
return string

$projectId public property

Project identifier (UUID)
public string $projectId
return string

$shared public property

Share type
public int $shared
return integer