Пример #1
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 (count($this->identifier) === 1) {
         return current($this->getIdentifierValues($entity));
     }
     return parent::createIndex($entity);
 }
Пример #2
0
 /**
  * Creates a new unique index for this model.
  *
  * If the model 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($model)
 {
     if (1 === count($this->identifier)) {
         return current($this->getIdentifierValues($model));
     }
     return parent::createIndex($model);
 }
Пример #3
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 $entity 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 $this->fixIndex(current($this->getIdentifierValues($entity)));
     }
     return parent::createIndex($entity);
 }