EcircleBundle
EcircleBundle is part of the framework BigFoot created by C2IS., (*1)
Installation
Add 'bigfoot/ecircle-bundle' into your composer.json file in the 'require' section:, (*2)
``` json
// composer.json
"require": {
...
...
"bigfoot/ecircle-bundle": "dev-master",
}, (*3)
Update your project:
``` shell
php composer.phar update
Enter your credentials in the config file:, (*4)
``` shell, (*5)
app/config.yml
...
...
parameters:
bigfoot_ecircle:
client:
wsdl_url: 'http://webservices.ecircle-ag.com/soap/ecm.wsdl'
request:
account_1:
realm: 'http://your-ecircle-url.com'
user: 'User'
passwd: 'Password', (*6)
Create a class file into the directory Options with the name of the E-circle method followed by 'Options':
```php
// src/Bigfoot/Bundle/EcircleBundle/Options/SubscribeMemberByEmailOptions.php
namespace Bigfoot\Bundle\EcircleBundle\Options;
class subscribeMemberByEmailOptions
{
public $email;
public $groupId;
public $session;
public $sendMessage = false;
}
The parameters must be the same as the Ecircle method., (*7)
Create a new method in the service 'bigfoot_ecircle.client':, (*8)
// src/Bigfoot/Bundle/EcircleBundle/Services/BigfootEcircleClient.php
public function subscribeMemberByEmail($email,$groupId)
{
if (!$this->sessionId) {
throw new Exception('Client no connected');
}
$subscribeMemberByEmailOptions = $this->options('SubscribeMemberByEmail');
$subscribeMemberByEmailOptions->email = $email;
$subscribeMemberByEmailOptions->session = $this->sessionId;
$subscribeMemberByEmailOptions->groupId = $groupId;
$result = $this->client->subscribeMemberByEmail($subscribeMemberByEmailOptions);
return $result;
}
Usage
Into an action method:, (*9)
// Controller/DefaultController.php
$client = $this->get('bigfoot_ecircle.client')->connect('account_1');
$retour = $client->subscribeMemberByEmail('example@email.com','99');
$client->disconnect();