. * * @author Julien Fontanet * @license http://www.gnu.org/licenses/gpl-3.0-standalone.html GPLv3 * * @package Xen Orchestra Server */ namespace Manager; /** * */ abstract class XCPAbstract extends ManagerAbstract { /** * */ function batchImport(array $objects) { foreach ($objects as $id => $properties) { $properties['id'] = $id; unset($properties['uuid']); $n = $this->_database->update( $this->_table, array('id' => $id), $properties ); if (1 === $n) { echo $this->_table.': updated ('.$id.')', PHP_EOL; } elseif (0 === $n) { $this->_database->create( $this->_table, array($properties) ); echo $this->_table.': new ('.$id.')', PHP_EOL; } else { trigger_error( 'unexpected number of updated '.$this->_table.' ('.$n.')', E_USER_ERROR ); } } } }