61 lines
1.6 KiB
PHP
61 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Factory;
|
|
|
|
use App\Entity\Image;
|
|
use App\Repository\ImageRepository;
|
|
use Zenstruck\Foundry\ModelFactory;
|
|
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;
|
|
use Zenstruck\Foundry\Persistence\Proxy;
|
|
use Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator;
|
|
|
|
/**
|
|
* @extends PersistentProxyObjectFactory<Image>
|
|
*/
|
|
final class ImageFactory extends ModelFactory
|
|
{
|
|
/**
|
|
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
|
|
*
|
|
* @todo inject services if required
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
|
*
|
|
* @todo add your default values here
|
|
*/
|
|
protected function getDefaults(): array
|
|
{
|
|
return [
|
|
'client' => ClientFactory::new(),
|
|
'createdAt' => self::faker()->dateTime(),
|
|
'name' => self::faker()->text(255),
|
|
'path' => self::faker()->text(255),
|
|
'size' => self::faker()->randomNumber(),
|
|
'softwareProfile' => SoftwareProfileFactory::new(),
|
|
'type' => self::faker()->text(255),
|
|
'updatedAt' => self::faker()->dateTime(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
|
*/
|
|
protected function initialize(): self
|
|
{
|
|
return $this
|
|
// ->afterInstantiate(function(Image $image): void {})
|
|
;
|
|
}
|
|
|
|
protected static function getClass(): string
|
|
{
|
|
return Image::class;
|
|
}
|
|
}
|