AbstractIdGenerator.php 753 Bytes
Newer Older
1 2
<?php

3
namespace Doctrine\ORM\Id;
4

5 6
use Doctrine\ORM\EntityManager;

7
abstract class AbstractIdGenerator
8
{
9 10 11 12 13 14
    /**
     * Generates an identifier for an entity.
     *
     * @param Doctrine\ORM\Entity $entity
     * @return mixed
     */
15
    abstract public function generate(EntityManager $em, $entity);
16 17 18 19 20

    /**
     * Gets whether this generator is a post-insert generator which means that
     * {@link generate()} must be called after the entity has been inserted
     * into the database.
21
     * 
22 23 24 25 26
     * By default, this method returns FALSE. Generators that have this requirement
     * must override this method and return TRUE.
     *
     * @return boolean
     */
27 28
    public function isPostInsertGenerator()
    {
29 30
        return false;
    }
31
}