i would ask the same about casting again. shouldn't be $object->attribute( "id"  ) and integer always?