Skip to content

Releases: zenstruck/foundry

v2.8.0

09 Nov 13:01

Choose a tag to compare

This release introduces a new attribute #[AsFoundryHook], which allows to declare Foundry hooks as Symfony services. It also permits to have "global" hooks for all kind of objects created with Foundry:

final class FoundryHook
{
    #[AsFoundryHook(Post::class)]
    public function beforeInstantiate(BeforeInstantiate $event): void
    {
        // do something before the post is instantiated:
        // $event->parameters is what will be used to instantiate the object, manipulate as required
        // $event->objectClass is the class of the object being instantiated
        // $event->factory is the factory instance which creates the object
    }

    #[AsFoundryHook(Post::class)]
    public function afterInstantiate(AfterInstantiate $event): void
    {
        // $event->object is the instantiated Post object
        // $event->parameters contains the attributes used to instantiate the object and any extras
        // $event->factory is the factory instance which creates the object
    }

    #[AsFoundryHook(Post::class)]
    public function afterPersist(AfterPersist $event): void
    {
        // this event is only called if the object was persisted
        // $event->object is the persisted Post object
        // $event->parameters contains the attributes used to instantiate the object and any extras
        // $event->factory is the factory instance which creates the object
    }

    #[AsFoundryHook]
    public function afterInstantiateGlobal(AfterInstantiate $event): void
    {
        // Omitting the class defines a "global" hook which will be called for all objects
    }
}

8dc0b1f feat(2.8): introduce #[AsFoundryHook] attribute (#986) by @nikophil
bf4549c feat(2.8): dispatch events (#974) by @nikophil
8516af1 docs: Remove array params on function alwaysForce (#1028) by @philpichet
5f3a6b1 feat: add hooks priority (#1029) by @nikophil

Full Change List

v2.7.9

07 Nov 08:38

Choose a tag to compare

41ab3ae fix: auto-refresh with Mongo after DoctrineMongoDBBundle 5.4.3 (#1030) by @nikophil

Full Change List

v2.7.8

05 Nov 09:34

Choose a tag to compare

728c8f8 minor: Add default value to Factory::attributes (#1026) by @VincentLanglet
0fe1017 tests: ensure Doctrine lifecycle works (#1020) by @nikophil
1247b0b chore: remove paratest from dev dependencies (#1023) by @nikophil
11355a9 chore: add concurrency for all workflows (#1019) by @nikophil
fed6e4a chore: fix rector with bamarni (#1018) by @nikophil
545cf18 chore: split CIs and add concurrency (#1017) by @nikophil
17796f2 chore: add bc-check to CI (#1016) by @nikophil
b8ced9b chore: disable sync template for cs config (#1015) by @nikophil
b802463 chore: some housekeeping (#1014) by @nikophil

Full Change List

v2.7.7

23 Oct 06:51

Choose a tag to compare

7766a85 fix: only use PersistedObjectsTracker when auto-refresh is enabled (#1013) by @nikophil

Full Change List

v2.7.6

20 Oct 16:46

Choose a tag to compare

95d2a96 fix: autorefresh should work after kernel shutdown (#1011) by @nikophil
0ea8430 tests: ensure OneToMany relationships are refreshed (#1010) by @nikophil
3c6faff fix: RepositoryAssertion::exist() $criteria should allow mixed (#1007) by @nikophil
81cc97d minor: accept as story any child of Story (#1006) by @alsciende
e99f3b0 chore: run rector CI with PHPUnit 12 (#1002) by @nikophil

Full Change List

v2.7.5

10 Oct 11:41

Choose a tag to compare

81eacf5 docs: add a note about using make:factory --test (#1000) by @ttskch
660942d [Rector] Add rector to require-dev and use single autoload vendor for run PHPUnit (#1001) by @samsonasik
f06d58d fix: using refresh_all() with flush_after() (#999) by @HypeMC

Full Change List

v2.7.4

08 Oct 13:22

Choose a tag to compare

9489e83 fix: 🐛 use isser instead of constructor to apply autorefresh setting to Factory (#998) by @ttskch

Full Change List

v2.7.3

05 Oct 09:50

Choose a tag to compare

45214f7 fix: revert adding PersistManager::findBy() (#996) by @nikophil
b36b9b3 chore: upgrade PHPStan (#997) by @nikophil
55f2689 fix: edge case with Doctrine Middleware & early kernel boot (#993) by @HypeMC
9fa21b3 fix(repository): use IN() when an array is passed (#995) by @nikophil
cad1466 fix: handle readonly when refreshing from repository decorator (#989) by @nikophil
b4b2ffe fix: Enhanced random method with additional safety check. (#991) by @sofwar

Full Change List

v2.7.2

25 Sep 05:36

Choose a tag to compare

97b60b6 fix: applyStateMethod should not be internal (#988) by @nikophil

Full Change List

v2.7.1

24 Sep 15:50

Choose a tag to compare

90866d2 fix(autorefresh): return fresh data from RepositoryDecorator methods (#983) by @nikophil
485746e fix(autorefresh): don't use clone to get the id values (#980) by @nikophil
21b659b chore: fix issue template (#982) by @nikophil
5d02ac6 Fix link to UPGRADE-2.7.md file (#978) by @Kocal

Full Change List