Skip to content

Commit 85d937b

Browse files
authored
Merge pull request #373 from os2display/feature/extra-lazy-collections
Set fetch: extra lazy on all collections doctrine associations
2 parents 820d749 + f48a607 commit 85d937b

13 files changed

Lines changed: 21 additions & 21 deletions

src/Entity/ScreenLayout.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ class ScreenLayout extends AbstractBaseEntity implements MultiTenantInterface, R
3333
/**
3434
* @var Collection<int, Screen>
3535
*/
36-
#[ORM\OneToMany(targetEntity: Screen::class, mappedBy: 'screenLayout')]
36+
#[ORM\OneToMany(mappedBy: 'screenLayout', targetEntity: Screen::class, fetch: 'EXTRA_LAZY')]
3737
private Collection $screens;
3838

3939
/**
4040
* @var Collection<int, ScreenLayoutRegions>
4141
*/
42-
#[ORM\OneToMany(targetEntity: ScreenLayoutRegions::class, mappedBy: 'screenLayout')]
42+
#[ORM\OneToMany(targetEntity: ScreenLayoutRegions::class, fetch: 'EXTRA_LAZY', mappedBy: 'screenLayout')]
4343
private Collection $regions;
4444

4545
public function __construct()

src/Entity/ScreenLayoutRegions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ScreenLayoutRegions extends AbstractBaseEntity implements MultiTenantInter
4141
/**
4242
* @var Collection<int, PlaylistScreenRegion>
4343
*/
44-
#[ORM\OneToMany(targetEntity: PlaylistScreenRegion::class, cascade: ['persist', 'remove'], mappedBy: 'region', orphanRemoval: true)]
44+
#[ORM\OneToMany(targetEntity: PlaylistScreenRegion::class, fetch: 'EXTRA_LAZY', cascade: ['persist', 'remove'], mappedBy: 'region', orphanRemoval: true)]
4545
private Collection $playlistScreenRegions;
4646

4747
public function __construct()

src/Entity/Template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Template extends AbstractBaseEntity implements MultiTenantInterface, Relat
3030
/**
3131
* @var Collection<int, Slide>
3232
*/
33-
#[ORM\OneToMany(targetEntity: Slide::class, mappedBy: 'template')]
33+
#[ORM\OneToMany(mappedBy: 'template', targetEntity: Slide::class, fetch: 'EXTRA_LAZY')]
3434
private Collection $slides;
3535

3636
public function __construct()

src/Entity/Tenant.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Tenant extends AbstractBaseEntity implements \JsonSerializable
2222
/**
2323
* @var Collection<int, UserRoleTenant>
2424
*/
25-
#[ORM\OneToMany(targetEntity: UserRoleTenant::class, mappedBy: 'tenant', orphanRemoval: true)]
25+
#[ORM\OneToMany(mappedBy: 'tenant', targetEntity: UserRoleTenant::class, fetch: 'EXTRA_LAZY', orphanRemoval: true)]
2626
private Collection $userRoleTenants;
2727

2828
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)]

src/Entity/Tenant/FeedSource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class FeedSource extends AbstractTenantScopedEntity implements RelationsChecksum
2929
/**
3030
* @var Collection<int, Feed>
3131
*/
32-
#[ORM\OneToMany(targetEntity: Feed::class, mappedBy: 'feedSource', orphanRemoval: true)]
32+
#[ORM\OneToMany(mappedBy: 'feedSource', targetEntity: Feed::class, fetch: 'EXTRA_LAZY', orphanRemoval: true)]
3333
private Collection $feeds;
3434

3535
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]

src/Entity/Tenant/Media.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Media extends AbstractTenantScopedEntity implements RelationsChecksumInter
5252
/**
5353
* @var Collection<int, Slide>
5454
*/
55-
#[ORM\ManyToMany(targetEntity: Slide::class, mappedBy: 'media')]
55+
#[ORM\ManyToMany(targetEntity: Slide::class, mappedBy: 'media', fetch: 'EXTRA_LAZY')]
5656
private Collection $slides;
5757

5858
public function __construct()

src/Entity/Tenant/Playlist.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,32 +31,32 @@ class Playlist extends AbstractTenantScopedEntity implements MultiTenantInterfac
3131
/**
3232
* @var Collection<int, ScreenCampaign>
3333
*/
34-
#[ORM\OneToMany(mappedBy: 'campaign', targetEntity: ScreenCampaign::class, orphanRemoval: true)]
34+
#[ORM\OneToMany(mappedBy: 'campaign', targetEntity: ScreenCampaign::class, fetch: 'EXTRA_LAZY', orphanRemoval: true)]
3535
private Collection $screenCampaigns;
3636

3737
/**
3838
* @var Collection<int, ScreenGroupCampaign>
3939
*/
40-
#[ORM\OneToMany(mappedBy: 'campaign', targetEntity: ScreenGroupCampaign::class, orphanRemoval: true)]
40+
#[ORM\OneToMany(mappedBy: 'campaign', targetEntity: ScreenGroupCampaign::class, fetch: 'EXTRA_LAZY', orphanRemoval: true)]
4141
private Collection $screenGroupCampaigns;
4242

4343
/**
4444
* @var Collection<int, PlaylistScreenRegion>
4545
*/
46-
#[ORM\OneToMany(mappedBy: 'playlist', targetEntity: PlaylistScreenRegion::class, orphanRemoval: true)]
46+
#[ORM\OneToMany(mappedBy: 'playlist', targetEntity: PlaylistScreenRegion::class, fetch: 'EXTRA_LAZY', orphanRemoval: true)]
4747
private Collection $playlistScreenRegions;
4848

4949
/**
5050
* @var Collection<int, PlaylistSlide>
5151
*/
52-
#[ORM\OneToMany(mappedBy: 'playlist', targetEntity: PlaylistSlide::class, orphanRemoval: true)]
52+
#[ORM\OneToMany(mappedBy: 'playlist', targetEntity: PlaylistSlide::class, fetch: 'EXTRA_LAZY', orphanRemoval: true)]
5353
#[ORM\OrderBy(['weight' => Order::Ascending->value])]
5454
private Collection $playlistSlides;
5555

5656
/**
5757
* @var Collection<int, Schedule>
5858
*/
59-
#[ORM\OneToMany(mappedBy: 'playlist', targetEntity: Schedule::class, cascade: ['persist'], orphanRemoval: true)]
59+
#[ORM\OneToMany(mappedBy: 'playlist', targetEntity: Schedule::class, cascade: ['persist'], fetch: 'EXTRA_LAZY', orphanRemoval: true)]
6060
private Collection $schedules;
6161

6262
public function __construct()

src/Entity/Tenant/Screen.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,20 @@ class Screen extends AbstractTenantScopedEntity implements RelationsChecksumInte
4646
/**
4747
* @var Collection<int, ScreenCampaign>
4848
*/
49-
#[ORM\OneToMany(mappedBy: 'screen', targetEntity: ScreenCampaign::class, orphanRemoval: true)]
49+
#[ORM\OneToMany(mappedBy: 'screen', targetEntity: ScreenCampaign::class, fetch: 'EXTRA_LAZY', orphanRemoval: true)]
5050
private Collection $screenCampaigns;
5151

5252
/**
5353
* @var Collection<int, PlaylistScreenRegion>
5454
*/
55-
#[ORM\OneToMany(mappedBy: 'screen', targetEntity: PlaylistScreenRegion::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
55+
#[ORM\OneToMany(mappedBy: 'screen', targetEntity: PlaylistScreenRegion::class, cascade: ['persist', 'remove'], fetch: 'EXTRA_LAZY', orphanRemoval: true)]
5656
#[ORM\OrderBy(['weight' => \Doctrine\Common\Collections\Order::Ascending->value])]
5757
private Collection $playlistScreenRegions;
5858

5959
/**
6060
* @var Collection<int, ScreenGroup>
6161
*/
62-
#[ORM\ManyToMany(targetEntity: ScreenGroup::class, mappedBy: 'screens')]
62+
#[ORM\ManyToMany(targetEntity: ScreenGroup::class, mappedBy: 'screens', fetch: 'EXTRA_LAZY')]
6363
private Collection $screenGroups;
6464

6565
public function __construct()

src/Entity/Tenant/ScreenGroup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ class ScreenGroup extends AbstractTenantScopedEntity implements RelationsChecksu
2222
/**
2323
* @var Collection<int, ScreenGroupCampaign>
2424
*/
25-
#[ORM\OneToMany(mappedBy: 'screenGroup', targetEntity: ScreenGroupCampaign::class, orphanRemoval: true)]
25+
#[ORM\OneToMany(mappedBy: 'screenGroup', targetEntity: ScreenGroupCampaign::class, fetch: 'EXTRA_LAZY', orphanRemoval: true)]
2626
private Collection $screenGroupCampaigns;
2727

2828
/**
2929
* @var Collection<int, Screen>
3030
*/
31-
#[ORM\ManyToMany(targetEntity: Screen::class, inversedBy: 'screenGroups')]
31+
#[ORM\ManyToMany(targetEntity: Screen::class, inversedBy: 'screenGroups', fetch: 'EXTRA_LAZY')]
3232
private Collection $screens;
3333

3434
public function __construct()

src/Entity/Tenant/Slide.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Slide extends AbstractTenantScopedEntity implements RelationsChecksumInter
4242
/**
4343
* @var Collection<int, Media>
4444
*/
45-
#[ORM\ManyToMany(targetEntity: Media::class, inversedBy: 'slides')]
45+
#[ORM\ManyToMany(targetEntity: Media::class, inversedBy: 'slides', fetch: 'EXTRA_LAZY')]
4646
private Collection $media;
4747

4848
/**

0 commit comments

Comments
 (0)