/** * 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); }
/** * 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); }
/** * 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); }