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

3
#namespace Doctrine\ORM\Id;
4 5 6 7 8 9

/**
 * Enter description here...
 *
 * @todo Rename to AbstractIdGenerator
 */
romanb's avatar
romanb committed
10
abstract class Doctrine_ORM_Id_AbstractIdGenerator
11
{    
12 13
    protected $_em;
    
14
    public function __construct(Doctrine_ORM_EntityManager $em)
15 16 17
    {
        $this->_em = $em;
    }
18 19 20 21 22 23 24

    /**
     * Generates an identifier for an entity.
     *
     * @param Doctrine\ORM\Entity $entity
     * @return mixed
     */
25
    abstract public function generate($entity);
26 27 28 29 30 31 32 33 34 35 36 37 38

    /**
     * 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.
     * By default, this method returns FALSE. Generators that have this requirement
     * must override this method and return TRUE.
     *
     * @return boolean
     */
    public function isPostInsertGenerator() {
        return false;
    }
39 40
}