Skip to content

Commit bd50a86

Browse files
authored
merge 2.5.x into 2.x (#931)
* fix: remove useless Configuration::boted() check (#929) * bot: fix cs [skip ci] * changelog: update [skip ci] --------- Co-authored-by: nikophil <[email protected]>
1 parent 159d700 commit bd50a86

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# CHANGELOG
22

3+
## [v2.5.5](https://github.com/zenstruck/foundry/releases/tag/v2.5.5)
4+
5+
June 4th, 2025 - [v2.5.4...v2.5.5](https://github.com/zenstruck/foundry/compare/v2.5.4...v2.5.5)
6+
7+
* 8238e0f fix: remove useless Configuration::boted() check (#929) by @nikophil
8+
39
## [v2.5.4](https://github.com/zenstruck/foundry/releases/tag/v2.5.4)
410

511
May 31st, 2025 - [v2.5.3...v2.5.4](https://github.com/zenstruck/foundry/compare/v2.5.3...v2.5.4)

src/Persistence/PersistentObjectFactory.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -449,12 +449,6 @@ protected function normalizeObject(string $field, object $object): object
449449

450450
final protected function initializeInternal(): static
451451
{
452-
if (!Configuration::isBooted()) {
453-
return $this;
454-
}
455-
456-
$this->persist = $this->isPersistenceEnabled() ? PersistMode::PERSIST : PersistMode::WITHOUT_PERSISTING;
457-
458452
// Schedule any new object for insert right after instantiation
459453
return parent::initializeInternal()
460454
->afterInstantiate(

tests/Integration/ORM/EntityRelationship/EntityFactoryRelationshipTestCase.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,27 @@ public function call_many_with_zero_do_nothing(): void
764764
static::contactFactory()::assert()->count(0);
765765
}
766766

767+
/**
768+
* @test
769+
* @dataProvider provideCanUseFactoryInDataProviderWithRelationshipCases
770+
* @param PersistentObjectFactory<Contact> $factory
771+
*/
772+
#[Test]
773+
#[DataProvider('provideCanUseFactoryInDataProviderWithRelationshipCases')]
774+
public function can_create_many_with_factory_from_data_provider_with_relationship(PersistentObjectFactory $factory): void
775+
{
776+
$objects = $factory->many(2)->create();
777+
778+
self::assertCount(2, $objects);
779+
}
780+
781+
public static function provideCanUseFactoryInDataProviderWithRelationshipCases(): iterable
782+
{
783+
yield [
784+
static::contactFactory(),
785+
];
786+
}
787+
767788
/** @return PersistentObjectFactory<Contact> */
768789
protected static function contactFactoryWithoutCategory(): PersistentObjectFactory
769790
{

0 commit comments

Comments
 (0)