getUpdatedById example


                'id' => $payload['id'],
                'orderDateTime' => (new \DateTimeImmutable())->format(Defaults::STORAGE_DATE_TIME_FORMAT),
            ],
        ]$context);

        $result = $orderRepository->search(
            new Criteria([$payload['id']]),
            $context
        )->first();

        static::assertNull($result->getUpdatedById());
    }

    public function testUpdatedByNotUpdateWithWrongSource(): void
    {
        /** @var EntityRepository $orderRepository */
        $orderRepository = $this->getContainer()->get('order.repository');
        $context = Context::createDefaultContext();

        $payload = $this->createOrderPayload();
        $orderRepository->create([$payload]$context);

        
$userRepository = $this->createUserWithId($userId);

        $orderPayload = $this->createOrderPayload();
        $orderPayload['updatedById'] = $userId;
        $orderRepository = $this->getContainer()->get('order.repository');
        $orderRepository->create([$orderPayload]$context);

        $userRepository->delete([['id' => $userId]]$context);

        /** @var OrderEntity $order */
        $order = $orderRepository->search(new Criteria([$orderPayload['id']])$context)->first();
        static::assertNull($order->getUpdatedById());
    }

    private function createUserWithId(string $userId): EntityRepository
    {
        $userRepository = $this->getContainer()->get('user.repository');
        $userRepository->create([
            [
                'id' => $userId,
                'firstName' => $userId,
                'lastName' => 'Test',
                'username' => $userId,
                
Home | Imprint | This part of the site doesn't use cookies.