Scalr_Account::getOwner PHP Method

getOwner() public method

public getOwner ( ) : Scalr_Account_User
return Scalr_Account_User
    public function getOwner()
    {
        $userId = $this->db->GetOne("SELECT id FROM account_users WHERE `account_id` = ? AND `type` = ? LIMIT 1", array($this->id, Scalr_Account_User::TYPE_ACCOUNT_OWNER));
        return Scalr_Account_User::init()->loadById($userId);
    }

Usage Example

Esempio n. 1
0
 protected function getUserInfoByAccountId($accountId)
 {
     if (!isset($this->accountsCache[$accountId])) {
         if ($accountId) {
             try {
                 $acc = new \Scalr_Account();
                 $acc->loadById($accountId);
                 $this->accountsCache[$accountId] = array('id' => $acc->getOwner()->id, 'email' => $acc->getOwner()->getEmail());
             } catch (\Exception $e) {
                 $this->console->error($e->getMessage());
                 return array('id' => 0, 'email' => '');
             }
         } else {
             $user = new \Scalr_Account_User();
             $user->loadByEmail('admin', 0);
             $this->accountsCache[$accountId] = array('id' => $user->id, 'email' => $user->getEmail());
         }
     }
     return $this->accountsCache[$accountId];
 }
All Usage Examples Of Scalr_Account::getOwner