Well the name is a random thing. I guess the collision risk is pretty low, unless somebody would have millions of nodes. Could we add the scheduled for insert names to the existing names array? Then the risk should be zero. Right now if i add 2 autonamed docs to same parents they already have the risk of collisions.

----- Reply message -----
Von: "Lukas Kahwe Smith" <notifications@github.com>
An: "doctrine/phpcr-odm" <phpcr-odm@noreply.github.com>
Cc: "David Buchmann" <david@liip.ch>
Betreff: [phpcr-odm] [WIP] PHPCR-103 implemented support for auto named documents (#321)
Datum: Do., Aug. 29, 2013 09:18
In lib/Doctrine/ODM/PHPCR/UnitOfWork.php: 
> @@ -1350,13 +1363,17 @@ public function persistNew(ClassMetadata $class, $document, $overrideIdGenerator 
>              $this->evm->dispatchEvent(Event::prePersist, new LifecycleEventArgs($document, $this->dm)); 
>          } 
>   
> -        $generator = $overrideIdGenerator ? $overrideIdGenerator : $class->idGenerator; 
> - 
> -        $id = $this->getIdGenerator($generator)->generate($document, $class, $this->dm, $parent); 
> -        $this->registerDocument($document, $id); 
> +        $generator = $this->getIdGenerator($overrideIdGenerator ? $overrideIdGenerator : $class->idGenerator); 
> +        if (ClassMetadata::GENERATOR_TYPE_AUTO === $class->idGenerator) { 
> +            $oid = spl_object_hash($document); 
> +            $this->documentInsertions[$oid] = $document; 

because if we do not .. there is a higher risk of collisions with the generated name. however if we decide to not care about this .. then things can get a lot easier and would likely allow us to support children. i am not sure how high the risk of such collisions are though. 

&mdash;
Reply to this email directly or view it on GitHub.