/** * @see EntityStore::assignFreshId() * * @param EntityDocument $entity * * @throws StorageException */ public function assignFreshId(EntityDocument $entity) { if ($entity->getId() !== null) { throw new StorageException('This entity already has an ID!'); } $contentModelId = $this->contentFactory->getContentModelForType($entity->getType()); $numericId = $this->idGenerator->getNewId($contentModelId); //FIXME: this relies on setId() accepting numeric IDs! $entity->setId($numericId); }
/** * @see EntityStore::assignFreshId * * @param EntityDocument $entity * * @throws StorageException */ public function assignFreshId(EntityDocument $entity) { //TODO: Find a canonical way to generate an EntityId from the maxId number. //XXX: Using setId() with an integer argument is deprecated! $numericId = ++$this->maxEntityId; $entity->setId($numericId); }