public function __construct($data = [], $connection = null) { $this->connection = $connection; foreach (['id', 'shipment_reference', 'tracking_url'] as $prop) { if (isset($data[$prop])) { $this->{$prop} = $data[$prop]; } } foreach (['sender', 'recipient'] as $prop) { $this->{$prop} = isset($data[$prop]) ? Address::import($data[$prop]) : null; } $this->product = isset($data['product']) ? Product::import($data['product']) : null; if (isset($data['parcels'])) { $this->parcels = []; foreach ($data['parcels'] as $parcel_data) { $this->parcels[] = Parcel::import($parcel_data); } } if (isset($data['labels'])) { $this->labels = []; foreach ($data['labels'] as $url) { $this->labels[] = Label::import($url, $connection); } } if (isset($data['order'])) { $this->order = Order::import($data['order'], $connection); } if (isset($data['allow'])) { $this->allow = $data['allow']; } }
<?php include "DataBase/database.php"; include "DataBase/Customer.php"; include "DataBase/Priceset.php"; include "DataBase/Product.php"; include "DataBase/Price.php"; include "DataBase/Category.php"; $customer = new Customer(); $priceset = new Priceset(); $product = new Product(); $price = new Price(); $category = new Category(); $folder = "mysql_import/"; $customer->import($folder . "customer.csv"); echo "kunden import<br>"; $priceset->import($folder . "priceset.csv"); echo "priceset import<br>"; $product->import($folder . "product.csv"); echo "product import<br>"; $price->import($folder . "price.csv"); echo "price import done<br>"; $category->import($folder . "category.csv"); echo "category import done<br>"; ?> <br> Synchronisation abgeschlossen