Skip to content

Commit

Permalink
[FEATURE] Increase performance of getting fingerprint values
Browse files Browse the repository at this point in the history
  • Loading branch information
einpraegsam committed Feb 26, 2024
1 parent 6299ac5 commit aa5e6d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions Classes/Domain/Model/Visitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ class Visitor extends AbstractModel
protected ?ObjectStorage $categoryscorings = null;

/**
* @Lazy
* @var ?ObjectStorage<Fingerprint>
* @phpstan-var ObjectStorage|LazyLoadingProxy|null
* Todo: Type can be changed to Company|LazyLoadingProxy|null when PHP 7.4 is dropped
*/
protected ?ObjectStorage $fingerprints = null;
protected ?object $fingerprints = null;

protected string $email = '';
protected string $company = '';
Expand Down Expand Up @@ -240,7 +243,9 @@ public function increaseCategoryscoringByCategory(int $value, Category $category

public function getFingerprints(): ?ObjectStorage
{
return $this->fingerprints;
return $this->fingerprints instanceof LazyLoadingProxy
? $this->fingerprints->_loadRealInstance()
: $this->fingerprints;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion ext_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ CREATE TABLE tx_lux_domain_model_visitor (
PRIMARY KEY (uid),
KEY parent (pid),
KEY frontenduser (frontenduser),
KEY fingerprints (fingerprints(20)),
KEY identified (identified),
KEY blacklisted (blacklisted),
KEY email (email(20)),
Expand Down Expand Up @@ -81,6 +80,7 @@ CREATE TABLE tx_lux_domain_model_fingerprint (

PRIMARY KEY (uid),
KEY parent (pid),
KEY visitor (visitor),
KEY value (value(33)),
KEY domain (domain(50)),
KEY user_agent (user_agent(50)),
Expand Down

0 comments on commit aa5e6d5

Please sign in to comment.