Пример #1
0
 public function testSetSubclass()
 {
     $newSubclass = new Subclass();
     $newSubclass->setId(1414);
     $this->queueItem->setSubclass($newSubclass);
     $this->assertEquals(1414, $this->queueItem->getSubclass()->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);
 }