Menu

#170 TComponent::allocateID doesn't guarantee unique IDs

open
nobody
5
2006-05-02
2006-05-02
verena
No

TComponent::allocateID doesn't guarantee unique IDs

For example:

In the first page cycle I create a component
dynamically without giving a specific id. I store the
new, automatically created id in the viewstate of the
parent component.
In the next page cycle I create a component and set its
id to the one Prado generated in the last page cycle.
Now I create a new component of the same type without
giving a specific id. Here Prado generates the same id
for this second component as it did in the last page
cycle for the first one.

I got rid of that by changing TComponent::allocateID to
the following:
Code:

private function allocateID($type)
{
while (isset($this->children['C_'.$type.$this->nextID]))
{
$this->nextID++;
}
return 'C_'.$type.$this->nextID;
}

Prado 2.1RC

Discussion


Log in to post a comment.