/** * Creates a new unique value 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 a value for * * @return integer|string A unique value without character limitations. */ protected function createValue($entity) { if (count($this->identifier) === 1) { return current($this->getIdentifierValues($entity)); } return parent::createValue($entity); }
/** * Creates a new unique value 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 a value for * * @return integer|string A unique value without character limitations. */ protected function createValue($model) { if (1 === count($this->identifier)) { return (string) current($this->getIdentifierValues($model)); } return parent::createValue($model); }
/** * Creates a new unique value 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 a value for * * @return integer|string A unique value without character limitations. */ protected function createValue($entity) { if ($this->idAsValue) { return (string) current($this->getIdentifierValues($entity)); } return parent::createValue($entity); }