Skip to content
This repository has been archived by the owner on Sep 22, 2018. It is now read-only.

fixed datetime issue. #1

Open
wants to merge 3 commits into
base: task-42940
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 23 additions & 16 deletions Classes/TYPO3/Soap/WsdlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ class WsdlGenerator {
protected $defaultTypeMap = array(
'string' => 'xsd:string',
'boolean' => 'xsd:boolean',
'integer' => 'xsd:integer',
'float' => 'xsd:float'
'integer' => 'xsd:int',
'float' => 'xsd:float',
'long' => 'xsd:long'
);

/**
Expand Down Expand Up @@ -265,6 +266,10 @@ protected function getMethodReturnAnnotation($className, $methodName) {
* @return string The namespace prefixed schema type
*/
protected function getOrCreateType($phpType, &$complexTypes, &$typeMapping) {
// don't need to map this class
$phpTypeWhiteList = array(
'\DateTime'
);
if (isset($typeMapping[$phpType])) {
return $typeMapping[$phpType];
}
Expand All @@ -282,7 +287,7 @@ protected function getOrCreateType($phpType, &$complexTypes, &$typeMapping) {
)
)
);
} elseif (strpos($phpType, '\\') !== FALSE) {
} elseif (strpos($phpType, '\\') !== FALSE ) {
$classReflection = new \TYPO3\Flow\Reflection\ClassReflection($phpType);
$typeName = substr($phpType, strrpos($phpType, '\\') + 1);
$typeMapping[$phpType] = 'tns:' . $typeName;
Expand All @@ -291,21 +296,23 @@ protected function getOrCreateType($phpType, &$complexTypes, &$typeMapping) {
'elements' => array(),
'documentation' => $classReflection->getDescription()
);
$methodNames = get_class_methods($phpType);
foreach ($methodNames as $methodName) {
if (strpos($methodName, 'get') === 0 && $this->reflectionService->isMethodPublic($phpType, $methodName)) {
$propertyName = lcfirst(substr($methodName, 3));
$propertyReflection = new \TYPO3\Flow\Reflection\PropertyReflection($phpType, $propertyName);
if (!in_array($phpType, $phpTypeWhiteList)) {
$methodNames = get_class_methods($phpType);
foreach ($methodNames as $methodName) {
if (strpos($methodName, 'get') === 0 && $this->reflectionService->isMethodPublic($phpType, $methodName)) {
$propertyName = lcfirst(substr($methodName, 3));
$propertyReflection = new \TYPO3\Flow\Reflection\PropertyReflection($phpType, $propertyName);

$minOccurs = $this->isPropertyRequired($phpType, $propertyName) ? 1 : 0;
$minOccurs = $this->isPropertyRequired($phpType, $propertyName) ? 1 : 0;

$returnType = $this->getMethodReturnAnnotation($phpType, $methodName);
$complexTypes[$typeName]['elements'][$propertyName] = array(
'name' => $propertyName,
'type' => $this->getOrCreateType($returnType['type'], $complexTypes, $typeMapping),
'attributes' => 'minOccurs="' . $minOccurs . '" maxOccurs="1" ',
'documentation' => $propertyReflection->getDescription()
);
$returnType = $this->getMethodReturnAnnotation($phpType, $methodName);
$complexTypes[$typeName]['elements'][$propertyName] = array(
'name' => $propertyName,
'type' => $this->getOrCreateType($returnType['type'], $complexTypes, $typeMapping),
'attributes' => 'minOccurs="' . $minOccurs . '" maxOccurs="1" ',
'documentation' => $propertyReflection->getDescription()
);
}
}
}
} else {
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
TYPO3.Soap
==========

TYPO3.Soap Flow Package, compatible with Flow 2.0

A soap package for TYPO3 Flow.