The Object is being created perfectly, I've checked.

The collection's Add() method is something like:


Since you know you're adding MyObject objects, first of all check for that: public function Add(MyObject $object)

          public function Add($object)

          {

                   $this->arr_objects[intval($object->position)] =
$object;           < THIS LINE IS THE PROBLEM

From the code provided, I don't see an $object->position property. Are you sure it is there and it is an integer? If you are only getting two values in your iterator then this expression might be evaluating a TRUE to a 1 and a FALSE to a 0... and would overwrite those indexes on each Add().



$this->count++;

}

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to