Webservice and relations

The properties of a model are easily exported to a soap webservice by adding the doc-comments




/**

 * @var string

 * @soap

 */

public $var;



how can I export the related Objects in a similar way?

The following seems not to be working…




/**

 * @var Contact

 * @soap

 */

public $contact


public function relations()

	{

		return array(

                    'contact' => array(self::BELONGS_TO, 'Contact', 'contact_id'),

                );

	}



The find() over a webservice always returns an empty contact. What is the right way to solve this?

Thanks,

Björn

Hi,

You need to map the class Contact on the wsdl like it’s explained hier.


class PostController extends CController

{

    public function actions()

    {

        return array(

            'service'=>array(

                'class'=>'CWebServiceAction',

                'classMap'=>array(

                    'Contact',

                ),

            ),

        );

    }

    ......

}

Don’t forget to also define the soap variables in the class Contact

regards,

Kevin