53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Factory;
|
||
|
|
|
||
|
|
use App\Entity\Restaurant;
|
||
|
|
use Doctrine\ORM\EntityRepository;
|
||
|
|
use Zenstruck\Foundry\Persistence\PersistentObjectFactory;
|
||
|
|
use Zenstruck\Foundry\Persistence\Proxy;
|
||
|
|
use Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @extends PersistentObjectFactory<Restaurant>
|
||
|
|
*/
|
||
|
|
final class RestaurantFactory extends PersistentObjectFactory
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
|
||
|
|
*
|
||
|
|
* @todo inject services if required
|
||
|
|
*/
|
||
|
|
public function __construct() {}
|
||
|
|
|
||
|
|
#[\Override]
|
||
|
|
public static function class(): string
|
||
|
|
{
|
||
|
|
return Restaurant::class;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
||
|
|
*
|
||
|
|
* @todo add your default values here
|
||
|
|
*/
|
||
|
|
#[\Override]
|
||
|
|
protected function defaults(): array|callable
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'name' => self::faker()->company(),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||
|
|
*/
|
||
|
|
#[\Override]
|
||
|
|
protected function initialize(): static
|
||
|
|
{
|
||
|
|
return $this
|
||
|
|
// ->afterInstantiate(function(Restaurant $restaurant): void {})
|
||
|
|
;
|
||
|
|
}
|
||
|
|
}
|