I also ran into this problem, since I wanted some identifiers to be the same for every run, since I want to send them in debugging applications using the UUID strategy.
What I've done:
1) Wrote a command that wraps hautelook:fixtures:load :
protected function execute(InputInterface $input, OutputInterface $output) { $container = $this->getContainer(); $entityManager = $container->get('doctrine.orm.default_entity_manager'); $metadata = $entityManager->getClassMetaData(App::class); $metadata->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_NONE); $metadata->setIdGenerator(new \Doctrine\ORM\Id\AssignedGenerator()); $application = new Application($kernel); $application->setAutoExit(false); $this->loadFixtures($application, $output); }
Make a $metadata material for all classes for which you want to have custom identifiers ( App::class ).
protected function loadFixtures(Application $application, OutputInterface $output) { $loadFixturesInput = new ArrayInput(array( 'command' => 'hautelook:fixtures:load', '--no-interaction' => 'true', '--verbose' => '3' )); $application->run($loadFixturesInput, $output); }
2) I created a template for creating the id similar doctrine.
id (template): id (unique): '<uuid()>'
3) In my custom object, I can now do the following:
app_custom (extends id): id: 'whatever-i-want' title: 'My custom entity'
4) And if I do not want to use a user identifier, I just do not overwrite the id field:
app_another (extends id): title: 'Just another app with an id I do not care about'
Evidence:

Thomas Kekeisen
source share