After an Order is created, the cart is set as Ordered enabling related
flag.

@param OrderOnCreatedEvent $event Event
501049
public function setCartAsOrdered(OrderOnCreatedEvent $event)
    {
        $cart = $event
            ->getCart()
            ->setOrdered(true);

        $this->cartObjectManager->flush($cart);
    }
1283769
public function afterPrepare(Event $event)
    {
        /* @var \Guzzle\Service\Command\CommandInterface $command */
        $command = $event['command'];
        $request = $command->getRequest();

        $request->getQuery()->setAggregator(new StripeQueryAggregator());
    }
38119
public function onStateChange(OrderEvent $event)
    {
        $order = $event->getOrder();

        // If new state is Accepted or Completed and type is not order
        if (in_array($order->getState(), [OrderStates::STATE_ACCEPTED, OrderStates::STATE_COMPLETED])
            && $order->getType() != OrderTypes::TYPE_ORDER
        ) {
            // Transform to an order
            $order
                ->setType(OrderTypes::TYPE_ORDER)
                ->setCreatedAt(new \DateTime())
                ->setNumber(null)
                ->setKey(null)
            ;

            $this->generateNumberAndKey($order);
            $this->handleAddresses($order);

            $errorList = $this->validator->validate($order, ['Default', 'Order']);
            if ($errorList->count() > 0) {
                $messages = [];
                foreach ($errorList as $error) {
                    $messages[] = $error->getMessage();
                }
                throw new OrderException('Invalid order : ' . implode('<br>', $messages));
            }
        }

        // Set completed at
        if ($order->getState() === OrderStates::STATE_COMPLETED && null === $order->getCompletedAt()) {
            $order->setCompletedAt(new \DateTime());
        }
    }
832957
public function create(OrderEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $session = $this->getSession();

        $order = $event->getOrder();
        $paymentModule = ModuleQuery::create()->findPk($order->getPaymentModuleId());

        $placedOrder = $this->createOrder(
            $dispatcher,
            $event->getOrder(),
            $session->getCurrency(),
            $session->getLang(),
            $session->getSessionCart($dispatcher),
            $this->securityContext->getCustomerUser()
        );

        $dispatcher->dispatch(TheliaEvents::ORDER_BEFORE_PAYMENT, new OrderEvent($placedOrder));

        /* but memorize placed order */
        $event->setOrder(new OrderModel());
        $event->setPlacedOrder($placedOrder);

        /* call pay method */
        $payEvent = new OrderPaymentEvent($placedOrder);

        $dispatcher->dispatch(TheliaEvents::MODULE_PAY, $payEvent);

        if ($payEvent->hasResponse()) {
            $event->setResponse($payEvent->getResponse());
        }
    }
1305789
public function dispatchOrderOnCreatedEvent(
        CartInterface $cart,
        OrderInterface $order
    ) {
        $orderPreCreatedEvent = new OrderOnCreatedEvent($cart, $order);
        $this->eventDispatcher->dispatch(
            ElcodiCartEvents::ORDER_ONCREATED,
            $orderPreCreatedEvent
        );

        return $this;
    }
1148851
public function createManual(OrderManualEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $event->setPlacedOrder(
            $this->createOrder(
                $dispatcher,
                $event->getOrder(),
                $event->getCurrency(),
                $event->getLang(),
                $event->getCart(),
                $event->getCustomer(),
                null,
                $event->getUseOrderDefinedAddresses()
            )
        );

        $event->setOrder(new OrderModel());
    }
921565
public function afterPaginate(Event $event)
    {
        $event;
        if (!$this->_table()->behaviors()->has('Search')) {
            return;
        }

        $enabled = $this->getConfig('enabled') ?: !$this->_request()->is('api');
        if (!$enabled) {
            return;
        }

        $fields = $this->fields();
        $this->_controller()->set('searchInputs', $fields);
    }
1139900
public function onCreate(CreateResourceEvent $event)
    {
        $request = $this->container->get('request');
        $form = $this->container->get('form.factory')->create(new FileType(true), new File());
        $form->handleRequest($request);

        if ($form->isValid()) {
            $this->handleFileCreation($form, $event);
        }

        $content = $this->container->get('templating')->render(
            'ClarolineCoreBundle:Resource:createForm.html.twig',
            array(
                'form' => $form->createView(),
                'resourceType' => $event->getResourceType()
            )
        );
        $event->setErrorFormContent($content);
        $event->stopPropagation();
    }
1018968
public function onCreateSession(CreateCourseSessionEvent $event)
    {
        $session = $event->getCourseSession();
        $options = new MatiereOptions();
        $options->setCourseSession($session);
        $this->om->persist($options);
        $this->om->flush();
    }
1139507
public function onCreate(CreateResourceEvent $event)
    {
        $request = $this->container->get('request_stack')->getMasterRequest();
        $form = $this->container->get('form.factory')->create(WebsiteType::class, new Website());
        $form->handleRequest($request);
        if ($form->isValid()) {
            $website = $form->getData();
            $event->setResources([$website]);
        } else {
            $content = $this->container->get('templating')->render(
                'ClarolineCoreBundle:resource:create_form.html.twig',
                [
                    'form' => $form->createView(),
                    'resourceType' => 'icap_website',
                ]
            );
            $event->setErrorFormContent($content);
        }
        $event->stopPropagation();
    }
178508
public function afterCreate(PersistenceEvent $event) {
    if ($event->getAction() == PersistenceAction::CREATE) {
      $oldOid = $event->getOldOid();
      $oldOidStr = $oldOid != null ? $oldOid->__toString() : null;
      if ($oldOidStr != null && isset($this->createdTranslations[$oldOidStr])) {
        foreach ($this->createdTranslations[$oldOidStr] as $translation) {
          $translation->setValue('objectid', $event->getObject()->getOID()->__toString());
        }
      }
    }
  }
634888
public function handleReorder(ReorderEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof RoutablePageBehavior || !$document instanceof ParentBehavior) {
            return;
        }

        $parentDocument = $document->getParent();
        if (!$parentDocument instanceof ChildrenBehavior) {
            return;
        }

        $locale = $this->documentInspector->getLocale($parentDocument);
        $propertyName = $this->getRoutePathPropertyName($parentDocument->getStructureType(), $locale);
        foreach ($parentDocument->getChildren() as $childDocument) {
            $node = $this->documentInspector->getNode($childDocument);

            $route = $this->chainRouteGenerator->generate($childDocument);
            $childDocument->setRoutePath($route->getPath());

            $node->setProperty($propertyName, $route->getPath());
        }
    }
205497
public function sendConfirmationEmail(OrderEvent $event)
    {
        if ($event->getOrder()->getPaymentModuleId() === Cheque::getModuleId()) {

            if ($event->getOrder()->isPaid()) {

                $order = $event->getOrder();

                $this->mailer->sendEmailToCustomer(
                    'order_confirmation_cheque',
                    $order->getCustomer(),
                    [
                        'order_id' => $order->getId(),
                        'order_ref' => $order->getRef()
                    ]
                );
            }
        }
    }
7956
public function addOrder(ORMFilterEvent $event)
    {
        $queryBuilder = $event->getQueryBuilder();
        $admin = $event->getAdmin();
        $actionConfiguration = $admin->getAction()->getConfiguration();

        $request = $this->requestStack->getMasterRequest();
        $sort = $request->get('sort');
        $alias = $queryBuilder->getRootAliases()[0];

        // The sort from the request override the configured one
        if ($sort) {
            $order = $request->get('order', 'asc');

            $queryBuilder->addOrderBy($alias.'.'.$sort, $order);
        } else {
            foreach ($actionConfiguration->getParameter('order') as $field => $order) {
                $queryBuilder->addOrderBy($alias.'.'.$field, $order);
            }
        }
    }
969598
public function postCreate(CreateEvent $event)
    {
        $organization = $event->getObject();
        $key = $this->cryptoManager->generatePair();
        $key->setOrganization($organization);
        $this->om->persist($key);
        $this->om->flush();
    }
239957
public function onSchemaIndexDefinition(SchemaIndexDefinitionEventArgs $event): void
    {
        $event->preventDefault();
        $data = $event->getTableIndex();

        $name = str_replace('.', '__', $data['name']);
        $event->setIndex(new Index($name, $data['columns'], $data['unique'], $data['primary'], $data['flags'], $data['options']));
    }
458388
public function checkSendOrderConfirmationMessageToCustomer(OrderEvent $event)
    {
        if (Paybox::getConfigValue('send_confirmation_email_on_successful_payment', false)) {
            $paybox = new Paybox();

            if ($paybox->isPaymentModuleFor($event->getOrder())) {
                if (!$event->getOrder()->isPaid()) {
                    $event->stopPropagation();
                }
            }
        }
    }