compared with
Version 6 by Jeannie BOFFEL
on Dec 08, 2010 04:25.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (10)

View Page History
||UC-01||

...
Exemple of definition of complex type which will check and assign values.
{code}
... /**
* @xsd sequence
* @xsd complexType
*/
class brotherDetail extends Zend_Soap_ComplexTypeValuesValidator
{
/**
* @var string
*/
public $firstName;
/**
* @var RankType
*/
public $rank;
/**
* @var AgeType
*/
public $age;

/**
* @param string $firstName
* @param RankType $rank
* @param AgeType $age
* @return brotherDetail
*/
public function __construct($firstName, $rank, $age) {
$this->Check_firstName = $firstName;
$this->Check_rank = $rank;
$this->Check_age = $age;

return $this;
}

}
If everything is ok, no output, if one value is wrong, exception.

{code}

||UC-02||

...
Exemple of definition of complex type which will only check assigned values then manually assign values.
__set magic method has syntax limitation, it will not be called even if property doesn't exist when used with auto index array for example.
We do not bother memory for nothing here, the $this->CheckO_Anything will never really exist in class properties, it's just a trick to call __set of parent class.
{code}
... /**
* @xsd sequence
* @xsd complexType
*/
class detailsBrotherList extends Zend_Soap_ComplexTypeValuesValidator
{
/**
* @var brotherDetail array('minOccurs'=>0, 'maxOccurs'=>"unbounded")
*/
public $brotherDetail;

/**
* @return detailsBrotherList
*/
public function __construct() {
$this->brotherDetail = array();
return $this;
}

/**
* @param brotherDetail $brotherDetail
*/
public function addStb($brotherDetail) {
$this->brotherDetail[] = $this->CheckO_brotherDetail = $brotherDetail;
}

}
{code}
If everything is ok, no output, if one value is wrong, exception.

||UC-03||

Here the same example but with handling of exception for debug help at programming moment and/or to send custome SoapFault to customer instead of invalid values or even try to fix the wrong value.
{code}
/**
* @xsd sequence
* @xsd complexType
*/
class detailsBrotherList extends Zend_Soap_ComplexTypeValuesValidator
{
/**
* @var brotherDetail array('minOccurs'=>0, 'maxOccurs'=>"unbounded")
*/
public $brotherDetail;

/**
* @return detailsBrotherList
*/
public function __construct() {
$this->brotherDetail = array();
return $this;
}

/**
* @param brotherDetail $brotherDetail
*/
public function addStb($brotherDetail) {
try {
$this->brotherDetail[] = $this->CheckO_brotherDetail = $brotherDetail;
} catch (Exception $e) {
throw new SoapFault('Server', $e->getMessage());
}
}

}
{code}
If everything is ok, no output, if one value is wrong, exception.

{zone-data}