I have created a function to be called via SOAP, but for some reason it is saving the model twice, even though I’m only saving it once:
The function:
/**
* Create a new model via Web Service
*
* @param string $click_through_url The URL for the Ad Jump
* @param string $file_name The name of the Creative file
* @param string $size The dimensions of the Creative file
* @param string $api_namespace The API namespace for the Ad Jump
* @return int ID of the new Ad Jump
* @soap
*/
public function createJump($click_through_url, $file_name, $size, $api_namespace)
{
$model = new Jump;
$model->ad_id = $this->getNextAdId();
$model->click_through_url = $click_through_url;
$model->file_name = $file_name;
$model->size = $size;
$model->api_namespace = $api_namespace;
$model->status = 1;
if ($model->save())
{
Yii::trace($model->ad_id);
return $model->ad_id;
}
else
Yii::trace(print_r($model->getErrors(),1));
return 0;
}
The call:
$client = new SoapClient('http://www.asdf.com/api');
echo $client->createJump(
'http://www.someurl.com',
'my-creative.jpg',
'300x250',
'myapikey'
);
It’s all working exactly as expected, except for the model being saved twice (because i get two new records in the DB)… Tearing my hair out!
Thanks for any help…