Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Doctrine Factory Laravel Package

nolanos/laravel-doctrine-factory

View on GitHub
Deep Wiki
Context7
v3.3.1

Testing publishing webhook

v3.2.0

Add support for Laravel 13

v3.1.0

Add support for laravel 12

v3.0.0

Support laravel-doctrine/orm v3

v2.0.0

Breaking Change

DoctrineFactory()->make() now persists entities.

This let's the creation process simpler as we can assume everything is already persisted and just flush at the end. It should help with cascade issues.

v1.7.6
v1.7.5
v1.7.4

Make sure to ignore uninitialized properties when creating objects.

v1.7.3

Fix factories as defaults

v1.7.2

The metadata factory wasn't a reliable method of checking if something is an entity. Instead, just blindly attempt to persist.

v1.7.1

The metadata factory wasn't a reliable method of checking if something is an entity. Instead, just blindly attempt to persist.

v1.7.0

Support passing factories into the create method, even if the relationship doesn't enable cascade persist.

Post::factory()->create([ 'author' => Author::factory()]);

This also means that factories can use factories in the default definition:

class PostFactory extends DoctrineFactory
{
    protected $model = Post::class;

    public function definition(): array
    {
        return [
            'title' => fake()->name(),
            'author' => User::factory(),
        ];
    }
}
v1.6.0
  • DoctrinFactory@for can be used for parents that need to be passed to the constructor
v1.4.0

New Features

v1.3.1

Bug Fix

Support null parameters to constructor

v1.3.0

Breaking Changes

None

New Features

  • DoctrineFactory now instantiates Entities through their constructor.

Bug Fixes

None

v1.2.0

Breaking Changes

  • None

Additions

  • Add support for sequences
  • Add support for count i.e. creating multiple instances
  • Expanded for support to include
    • Passing in factories (not just instances)
    • Specifying the relationship name
    • Magic methods e.g. forUser acts as for(User::Factory())

Bug Fixes

None

v1.1.0

Overrides the for method so that it can now be used for Doctrine relationships.

It will infer the name of the relationship based on the class name.

Post::factory()->for($user)->create(); // Sets $post->user;

Relationship name can be overriden:

Post::factory()->for($user, 'author')->create(); // Sets $post->author;

Note: Unlike the method it overrides, it does not yet accept a Factory.

v1.0.2
v1.0.1
v1.0.0
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai