public function findById($id)
 {
     $sql = "SELECT rq.*, ra.job_id FROM " . self::TABLE_REBALANCER_QUEUE . " rq\n                  LEFT JOIN " . self::TABLE_REBALANCER_ACTION . " ra On ra.id = rq.rebalancer_action_id\n                  WHERE rq.id = :id\n                  ";
     $result = $this->db->queryOne($sql, array('id' => $id));
     if (empty($result)) {
         return null;
     }
     /** @var QueueItem $item */
     $item = $this->bindObject($result);
     if (isset($result['security_id'])) {
         $security = new Security();
         $security->setId($result['security_id']);
         $item->setSecurity($security);
     }
     if (isset($result['system_client_account_id'])) {
         $account = new Account();
         $account->setId($result['system_client_account_id']);
         $item->setAccount($account);
     }
     if (isset($result['lot_id'])) {
         $lot = new Lot();
         $lot->setId($result['lot_id']);
         $item->setLot($lot);
     }
     return $item;
 }
Esempio n. 2
0
 public function testSetAccount()
 {
     $account = new Account();
     $account->setId(96);
     $this->queueItem->setAccount($account);
     $this->assertEquals(96, $this->queueItem->getAccount()->getId());
 }