Esempio n. 1
0
 public function testSetAccount()
 {
     $account = new Account();
     $account->setId(96);
     $this->queueItem->setAccount($account);
     $this->assertEquals(96, $this->queueItem->getAccount()->getId());
 }
 public function save(QueueItem $item)
 {
     if (null === $item->getId()) {
         $sql = "INSERT INTO " . self::TABLE_REBALANCER_QUEUE . " (lot_id, security_id, rebalancer_action_id, quantity, status, system_client_account_id, amount, subclass_id)\n                      VALUES (:lot_id, :security_id, :rebalancer_action_id, :quantity, :status, :account_id, :amount, :subclass_id);\n            ";
         $parameters = array('lot_id' => $item->getLot() ? $item->getLot()->getId() : null, 'security_id' => $item->getSecurity()->getId(), 'rebalancer_action_id' => $item->getRebalancerActionId(), 'quantity' => $item->getQuantity(), 'status' => $item->getStatus(), 'account_id' => $item->getAccount()->getId(), 'amount' => $item->getAmount(), 'subclass_id' => $item->getSubclass()->getId());
     } else {
         $sql = "UPDATE " . self::TABLE_REBALANCER_QUEUE . " SET quantity = :quantity, amount = :amount\n                      WHERE id = :id;\n            ";
         $parameters = array('id' => $item->getId(), 'quantity' => $item->getQuantity(), 'amount' => $item->getAmount());
     }
     $this->db->query($sql, $parameters);
 }