Ajoute tous les champs du formulaire

This commit is contained in:
Clement Desmidt 2016-09-12 16:41:57 +02:00
parent fa069edee8
commit 4f12d3da3b
1 changed files with 24 additions and 23 deletions

View File

@ -103,28 +103,29 @@ class Account
file_put_contents(sprintf('%s/add.html', $log_folder), $crawler->html()); file_put_contents(sprintf('%s/add.html', $log_folder), $crawler->html());
$form = $crawler->selectButton('Valider')->form(); $form = $crawler->selectButton('Valider')->form();
$image0 = fopen(sprintf('%s/%s/image0.jpg', DEALS_DIR, $deal->getId()), 'r'); $image0 = fopen(sprintf('%s/%s/image0.jpg', DEALS_DIR, $deal->getId()), 'r');
$fields = [ $fields = $form->getPhpValues();
'check_type_diff' => 0, $fields = array_merge(
'company_ad' => 0, $fields,
// TODO what are those ? [
'location_p' => sprintf('%s %s', $this->config->city, $this->config->postal_code), 'location_p' => sprintf('%s %s', $this->config->city, $this->config->postal_code),
'zipcode' => $this->config->postal_code, 'zipcode' => $this->config->postal_code,
'city' => $this->config->city, 'city' => $this->config->city,
'region' => $this->config->region, 'region' => $this->config->region,
'dpt_code' => $this->config->department, 'dpt_code' => $this->config->department,
'address' => $this->config->address, 'address' => $this->config->address,
'name' => $this->config->name, 'name' => $this->config->name,
'email' => $this->config->login, 'email' => $this->config->login,
'phone' => $this->config->phone, 'phone' => $this->config->phone,
'category' => $deal->getCategory(), 'category' => $deal->getCategory(),
'type' => $deal->getType(), 'type' => $deal->getType(),
'subject' => $deal->getSubject(), 'subject' => $deal->getSubject(),
'body' => $deal->getBody(), 'body' => $deal->getBody(),
'price' => $deal->getPrice(), 'price' => $deal->getPrice(),
'image0' => $image0, 'image0' => $image0,
'no_salesmen' => 1, 'no_salesmen' => 1,
'phone_hidden' => 0, 'phone_hidden' => 0,
]; ]
);
array_walk($fields, function (&$item, $key) { array_walk($fields, function (&$item, $key) {
$item = [ $item = [
'name' => $key, 'name' => $key,
@ -145,4 +146,4 @@ class Account
echo $e->getTraceAsString(); echo $e->getTraceAsString();
} }
} }
} }