Skip to content

Instantly share code, notes, and snippets.

@anvodev
Created May 12, 2020 19:31
Show Gist options
  • Select an option

  • Save anvodev/d3cdd748927ebc1c073b9acc52cc4e46 to your computer and use it in GitHub Desktop.

Select an option

Save anvodev/d3cdd748927ebc1c073b9acc52cc4e46 to your computer and use it in GitHub Desktop.
Determine how ID is generated
<?php
//src/Doctrine/CustomerIdGenerator.php
namespace App\Doctrine;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Id\AbstractIdGenerator;
class CustomerIdGenerator extends AbstractIdGenerator
{
public function generate(EntityManager $em, $entity)
{
return random_int(200000, 899999);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment