christiankerl / ckWebServicePlugin

Build SOAP and WSDL based web services with symfony 1.x.
MIT License
11 stars 5 forks source link

associative arrays #2

Closed mschnide closed 13 years ago

mschnide commented 13 years ago

With version 4.0.0 it is only possible to add a 'normal' array (index as numbers). Could it be possible to add also associative arrays? (index as strings)

Thanks

Or exists a solution to add associative arrays to this 'soap response generator' ?

christiankerl commented 13 years ago

It's not possible at the moment to have associative arrays. What's your usecase? Maybe I can give you some advice how to implement it for this special case.

mschnide commented 13 years ago

My example: I have an associative array, but would it transmit as an 'normal' array:

$itemlist = array('firstitem' => 'first', 'seconditem' => 'second');

first second

My workaround: Before creating the soap-response I change the associative array to a normal array.

A solution could be to have an annotation to ignore the keys ...

I don't know it it's possible.

Kind regards

Am Dienstag, 9. August 2011, 14:52:31 schrieben Sie:

It's not possible at the moment to have associative arrays. What's your usecase? Maybe I can give you some advice how to implement it for this special case.

christiankerl commented 13 years ago

another option is to model this with a class. if your keys are not varying you can just create a class with the keys as attributes. Or you introduce a class like:

<?php

MapEntry
{
  public $key;
  public $value;
}

and send an array of those objects.