public function findAllByCustomer(Customer $customer) { $customerField = $customer->isAnonymous() ? 'anonymousCustomerId' : 'customerId'; return $this->storage->findAllBy([$customerField => $customer->getId()]); }
public function findAllWithReferrer(Customer $customer) : array { $customerIdField = $customer->isAnonymous() ? 'anonymousCustomerId' : 'customerId'; return $this->storage->findAllBy(['type' => PageviewEvent::TYPE, 'data' => new ArrayValuesContains([PageviewEvent::REFERRER_FIELD => new NotEmpty()]), $customerIdField => $customer->getId()]); }