[DoctrineBridge] Added type check to prevent calling clear() on arrays