Пример #1
0
 public function execute()
 {
     $currentCount = $this->entity->getCount();
     if ($currentCount < $this->count) {
         $this->entity->setCount($this->count);
     }
 }
 public function execute()
 {
     $summary = [];
     foreach ($this->config->getPartnerPorts() as $port) {
         $data = $this->performRequest($this->config->getHost(), $port);
         foreach ($data as $row) {
             $id = $row['id'];
             $count = $row['count'];
             if (!isset($summary[$id])) {
                 $summary[$id] = $count;
             } elseif ($summary[$id] < $count) {
                 $summary[$id] = $count;
             }
         }
     }
     foreach ($summary as $id => $count) {
         $entity = new Cmd();
         $entity->setCount($count);
         $this->collection->set($id, $entity);
     }
 }