Commit 0e70550b authored by ZZZ[GONE] frebault's avatar ZZZ[GONE] frebault
Browse files

- Add GgusObjectInterface

  - Remove functions not used
parent a08b3e0f
......@@ -11,3 +11,8 @@ CHANGELOG
* Fix Interface suffix sor SLI
* Add BeSimple component and replace base soapClient by BeSimple\SoapClient\SoapClient.php
1.1.1
-----
* Add GgusObjectInterface
* Remove functions not used
\ No newline at end of file
......@@ -6,11 +6,13 @@ use GGUSHelpdesk\Exceptions\GgusObjectValidationException;
use GGUSHelpdesk\Exceptions\InvalidFieldException;
class GgusObject
class GgusObject implements GgusObjectInterface
{
protected $fields;
protected $lastValidationError;
const ID_LABEL = "GHD_Request_ID";
const MODIFICATION_DATE_LABEL = "GHD_Modified_Date";
public function __construct(Fields $fields)
{
......@@ -123,17 +125,10 @@ class GgusObject
}
}
//-------- common cMAP fields accessors ---------
public function getLogin()
{
return $this->fields->getValue('Login');
}
public function getId()
{
try {
$id = $this->fields->getValue('Id');
$id = $this->fields[self::ID_LABEL];
} catch (InvalidFieldException $tE) {
$id = null;
}
......@@ -141,30 +136,17 @@ class GgusObject
return $id;
}
public function setId($str)
{
return $this->fields->setValue('Id', $str);
}
public function setModifier($str)
{
$this->fields->setValue('Modifier', $str);
}
public function getModifier()
public function setId($id)
{
return $this->fields->getValue('Modifier');
$this->fields[self::ID_LABEL] = $id;
}
//-------- common xMAP fields accessors ---------
public function setHelpdesk($str)
{
$this->fields->setValue('Helpdesk', $str);
public function getModificationDate(){
return $this->fields[self::MODIFICATION_DATE_LABEL];
}
public function getHelpdesk()
public function setModificationDate($date)
{
return $this->fields->getValue('Helpdesk');
$this->fields[self::MODIFICATION_DATE_LABEL] = $date;
}
}
<?php
/**
* Created by PhpStorm.
* User: Pierre FREBAULT
* Date: 06/11/2014
* Time: 15:26
*/
namespace GGUSHelpdesk;
interface GgusObjectInterface {
function fromHelpdesk($data);
function toHelpdesk();
function getHelpdeskValue($id);
function getModificationDate();
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ use BeSimple\SoapClient\SoapClient;
/**
* provide basic access to ggus soap service
*/
abstract class SoapService
abstract class GgusSoapService
{
const GGUS_OBJECT_NOT_FOUND = "ERROR (302): Entry does not exist in database; ";
......@@ -64,10 +64,10 @@ abstract class SoapService
/**
* Check if ggusObject constants needed by helpdesk are properly set
* @param <GgusObject> ggusObject instance to check
* @param GgusObjectInterface ggusObject instance to check
* @return <bool> true if ggusObject is well formed, false otherwise
*/
protected function isGgusObjectWellformed(GgusObject $ggusobject)
protected function isGgusObjectWellformed(GgusObjectInterface $ggusobject)
{
// check default values
......@@ -88,6 +88,10 @@ abstract class SoapService
return true;
}
/**
* @param bool $setDefaultValues
* @return GgusObjectInterface
*/
abstract function createGgusObjectInstance($setDefaultValues = true);
protected function getGgusFieldInstance()
......
......@@ -3,13 +3,13 @@
namespace GGUSHelpdesk\resources;
use GGUSHelpdesk\GgusObject;
use \GGUSHelpdesk\SoapService;
use \GGUSHelpdesk\GgusSoapService;
/**
*
* @author Pierre FREBAULT
*/
class TestGgusSoapService extends SoapService
class TestGgusSoapService extends GgusSoapService
{
public function __construct(array $config, $name)
......
......@@ -56,8 +56,8 @@ class SoapServiceTest extends PHPUnit_Framework_TestCase {
'maps' =>array('cMap'=>$maps),
'urls'=>array('wsdl'=>'https://train-ars.ggus.eu/arsys/WSDL/public/train-ars'),
'authentication'=> array(
'userName'=>'****',
'password'=>'****')
'userName'=>'*****',
'password'=>'*****')
), 'GGUS_OPS');
var_dump($tss->__getGgusObject('51532','OpGetOps','GHD_Request_ID')->toHelpdesk());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment