/** * Delete customer * * DELETE /api/customers/{id} */ public function deleteAction() { $id = $this->Request()->getParam('id'); $this->resource->delete($id); $this->View()->assign(array('success' => true)); }
/** * Delete customer * * DELETE /api/customers/{id} */ public function deleteAction() { $id = $this->Request()->getParam('id'); $useNumberAsId = (bool) $this->Request()->getParam('useNumberAsId', 0); if ($useNumberAsId) { $this->resource->deleteByNumber($id); } else { $this->resource->delete($id); } $this->View()->assign(array('success' => true)); }
/** * Create dummy customer entity * * @return \Shopware\Models\Customer\Customer */ private function createDummyCustomer() { $date = new DateTime(); $date->modify('-8 days'); $lastLogin = $date->format(DateTime::ISO8601); $birthday = DateTime::createFromFormat('Y-m-d', '1986-12-20')->format(DateTime::ISO8601); $testData = array("password" => "fooobar", "email" => uniqid() . '*****@*****.**', "lastlogin" => $lastLogin, "billing" => array("firstName" => "Max", "lastName" => "Mustermann", "birthday" => $birthday, "attribute" => array('text1' => 'Freitext1', 'text2' => 'Freitext2'), "zipcode" => '12345', "countryId" => '2'), "shipping" => array("salutation" => "Mr", "company" => "Widgets Inc.", "firstName" => "Max", "lastName" => "Mustermann", "street" => "Merkel Strasse, 10", "attribute" => array('text1' => 'Freitext1', 'text2' => 'Freitext2')), "debit" => array("account" => "Fake Account", "bankCode" => "55555555", "bankName" => "Fake Bank", "accountHolder" => "Max Mustermann")); $customerResource = new \Shopware\Components\Api\Resource\Customer(); $customerResource->setManager(Shopware()->Models()); return $customerResource->create($testData); }