public function OrderController::createForUser in Ubercart 8.4
Creates an order for the specified user, and redirects to the edit page.
Parameters
\Drupal\user\UserInterface $user: The user to create the order for.
1 string reference to 'OrderController::createForUser'
- uc_order.routing.yml in uc_order/
uc_order.routing.yml - uc_order/uc_order.routing.yml
File
- uc_order/
src/ Controller/ OrderController.php, line 23
Class
- OrderController
- Controller routines for order routes.
Namespace
Drupal\uc_order\ControllerCode
public function createForUser(UserInterface $user) {
$order = Order::create([
'uid' => $user
->id(),
'order_status' => uc_order_state_default('post_checkout'),
]);
$order
->save();
uc_order_comment_save($order
->id(), $this
->currentUser()
->id(), $this
->t('Order created by the administration.'), 'admin');
return $this
->redirect('entity.uc_order.edit_form', [
'uc_order' => $order
->id(),
]);
}