Beispiel #1
0
 /**
  * After the rows have been imported or attempted to be imported, process the status and messages of each
  * row to the temporary table where these rows are stored. This information can then be used later as feedback
  * in the user interface on any issues that need resolving any of the rows.
  */
 public function processStatusAndMessagesForEachRow()
 {
     foreach ($this->rowResultsData as $rowResult) {
         assert('$rowResult instanceof ImportRowDataResultsUtil');
         $tableName = $this->import->getTempTableName();
         $status = $rowResult->getStatus();
         assert('$status != null');
         $messages = $rowResult->getMessages();
         if ($messages != null) {
             $serializedMessagesOrNull = serialize($messages);
         } else {
             $serializedMessagesOrNull = null;
         }
         $rowId = $rowResult->getId();
         ImportDatabaseUtil::updateRowAfterProcessing($tableName, $rowId, $status, $serializedMessagesOrNull);
     }
 }
 /**
  * @depends testGetCount
  */
 public function testUpdateRowAfterProcessing()
 {
     ImportDatabaseUtil::updateRowAfterProcessing('testimporttable', 2, 4, serialize(array('a' => 'b')));
     $bean = R::findOne('testimporttable', "id = :id", array('id' => 2));
     $this->assertEquals(4, $bean->status);
     $this->assertEquals(serialize(array('a' => 'b')), $bean->serializedmessages);
     $bean = R::findOne('testimporttable', "id = :id", array('id' => 1));
     $this->assertEquals(null, $bean->status);
     $this->assertEquals(null, $bean->serializedmessages);
     $bean = R::findOne('testimporttable', "id = :id", array('id' => 3));
     $this->assertEquals(null, $bean->status);
     $this->assertEquals(null, $bean->serializedmessages);
 }