Exemple #1
0
 public function execute(ExecutionContext $execution)
 {
     $data = $execution->read();
     // For data from pipe, we need to get back global metadata... Little crappy I know...
     $metadata = $execution->getContextMetadata();
     // Read data
     try {
         $data = $this->slice($execution, $metadata);
     } catch (\OutOfBoundsException $e) {
         // Message has no more data and should not be spread
         $execution->terminate();
         $data = [];
     }
     // No data
     if (count($data) <= 0) {
         $this->debug('No data');
     }
     // Store data read
     foreach ($data as $k => $result) {
         $metadata = $this->metadataAccessor->createMetadata($result, $metadata);
         $execution->write($result, $metadata);
     }
     // Limit total to the max if lesser
     if ($execution->hasNoTotal()) {
         $execution->changeTotal($this->count());
     }
     $execution->valid();
 }