PHP Class Scalr\Stats\CostAnalytics\Projects

Since: 5.0 (11.02.2014)
Author: Vitaliy Demidov ([email protected])
显示文件 Open project: scalr/scalr

Protected Properties

Property Type Description
$collection Scalr\Model\Collections\ArrayCollection
$db ADODB_mysqli Database connection instance

Public Methods

Method Description
__construct ( ADODB_mysqli $db ) Constructor
all ( boolean $ignoreCache = false, array $criteria = null ) : ArrayCollection Gets all projects
checkPermission ( string $projectId, array $criteria ) : boolean | mixed Checks if user has permissions to project in environment or account scope
findByKey ( string $key = null, array $criteria = null, $ignoreCache = false ) : ArrayCollection Finds projects by key It searches by name or billing number
get ( string $projectId, boolean $ignoreCache = false, array $criteria = null ) : ProjectEntity Gets a specified project
getAccountProjects ( integer $accountId, string $query = null ) : ArrayCollection Gets available projects for account scope
getFarmsList ( string $projectId ) : array Get the list of the farms which are assigned to specified project
getUsedInEnvironment ( integer $envId ) : array Gets the list of projects within environment

Private Methods

Method Description
parseFindCriteria ( array $criteria, string &$join, string &$where ) Parses common criteria

Method Details

__construct() public method

Constructor
public __construct ( ADODB_mysqli $db )
$db ADODB_mysqli Database connection instance

all() public method

It returns projects with all properties by one query
public all ( boolean $ignoreCache = false, array $criteria = null ) : ArrayCollection
$ignoreCache boolean optional Should it ignore cache or not
$criteria array optional Search criteria ['envId' => '', 'accountId' => '', 'accountId' => '']
return Scalr\Model\Collections\ArrayCollection Returns collection of all ProjectEntity objects

checkPermission() public method

Checks if user has permissions to project in environment or account scope
public checkPermission ( string $projectId, array $criteria ) : boolean | mixed
$projectId string Identifier of the project
$criteria array ['envId' => '', 'clientid' => '']
return boolean | mixed

findByKey() public method

Finds projects by key It searches by name or billing number
public findByKey ( string $key = null, array $criteria = null, $ignoreCache = false ) : ArrayCollection
$key string optional Search key
$criteria array optional Search criteria ['envId' => '', 'accountId' => '', 'accountId' => '']
return Scalr\Model\Collections\ArrayCollection Returns collection of the ProjectEntity objects

get() public method

Gets a specified project
public get ( string $projectId, boolean $ignoreCache = false, array $criteria = null ) : ProjectEntity
$projectId string The identifier of the project
$ignoreCache boolean optional Should it ignore cache or not
$criteria array optional Search criteria ['envId' => '', 'accountId' => '']
return Scalr\Stats\CostAnalytics\Entity\ProjectEntity Returns the ProjectEntity on success or null if it does not exist.

getAccountProjects() public method

Gets available projects for account scope
public getAccountProjects ( integer $accountId, string $query = null ) : ArrayCollection
$accountId integer Current user object
$query string optional Search criteria
return Scalr\Model\Collections\ArrayCollection

getFarmsList() public method

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

getUsedInEnvironment() public method

Gets the list of projects within environment
public getUsedInEnvironment ( integer $envId ) : array
$envId integer Identifier of the Environment
return array Returns array of the ProjectEntity objects

Property Details

$collection protected_oe property

protected ArrayCollection,Scalr\Model\Collections $collection
return Scalr\Model\Collections\ArrayCollection

$db protected_oe property

Database connection instance
protected ADODB_mysqli $db
return ADODB_mysqli