示例#1
0
 /**
  * Creates a new unique index for this choice.
  *
  * If a property path for the index was given at object creation,
  * the getter behind that path is now called to obtain a new value.
  *
  * Otherwise a new integer is generated.
  *
  * @param mixed $choice The choice to create an index for
  * @return integer|string A unique index containing only ASCII letters,
  *                        digits and underscores.
  */
 protected function createIndex($choice)
 {
     if ($this->indexPath) {
         return $this->indexPath->getValue($choice);
     }
     return parent::createIndex($choice);
 }
示例#2
0
 /**
  * Creates a new unique index for this entity.
  *
  * If the entity has a single-field identifier, this identifier is used.
  *
  * Otherwise a new integer is generated.
  *
  * @param mixed $choice The choice to create an index for
  *
  * @return integer|string A unique index containing only ASCII letters,
  *                        digits and underscores.
  */
 protected function createIndex($entity)
 {
     if ($this->idAsIndex) {
         return current($this->getIdentifierValues($entity));
     }
     return parent::createIndex($entity);
 }