ImportExport: return number of imported objects
This commit is contained in:
parent
1ca41c5b10
commit
17321e4a5f
|
@ -103,19 +103,27 @@ class ImportExport
|
|||
|
||||
public function unserializeImportSources($objects)
|
||||
{
|
||||
$this->connection->runFailSafeTransaction(function () use ($objects) {
|
||||
$count = 0;
|
||||
$this->connection->runFailSafeTransaction(function () use ($objects, & $count) {
|
||||
foreach ($objects as $object) {
|
||||
ImportSource::import($object, $this->connection)->store();
|
||||
$count++;
|
||||
}
|
||||
});
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function unserializeSyncRules($objects)
|
||||
{
|
||||
$this->connection->runFailSafeTransaction(function () use ($objects) {
|
||||
$count = 0;
|
||||
$this->connection->runFailSafeTransaction(function () use ($objects, & $count) {
|
||||
foreach ($objects as $object) {
|
||||
SyncRule::import($object, $this->connection)->store();
|
||||
}
|
||||
$count++;
|
||||
});
|
||||
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue