-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Import and Export for processing entity (#59)
* Add Import and Export for processing entity * Add import and export for Pia entity * Add pia import from processing json * Add a status class to translate status * Rename applied_adjustements pia field to applied_adjustments * Fix pia test * Add new fields in processing entity * Update processing tests
- Loading branch information
1 parent
a827b39
commit 4b0ed39
Showing
23 changed files
with
1,694 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright (C) 2015-2018 Libre Informatique | ||
* | ||
* This file is licensed under the GNU LGPL v3. | ||
* For the full copyright and license information, please view the LICENSE.md | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace PiaApi\DataExchange\Descriptor; | ||
|
||
class AbstractDescriptor | ||
{ | ||
protected function checkProperty($mode, $method) | ||
{ | ||
$attribute = false; | ||
$reflect = new \ReflectionClass($this); | ||
|
||
$name = lcfirst(str_replace($mode, '', $method)); | ||
$properties = array_column($reflect->getProperties(), 'name'); | ||
|
||
if (in_array($name, $properties)) { | ||
$attribute = $name; | ||
} | ||
|
||
return $attribute; | ||
} | ||
|
||
public function __call($method, $args) | ||
{ | ||
$value = false; | ||
|
||
if (strpos($method, 'set') !== false) { | ||
if ($name = $this->checkProperty('set', $method)) { | ||
$this->$name = $args[0]; | ||
} | ||
|
||
$value = true; | ||
} | ||
|
||
if (strpos($method, 'get') !== false) { | ||
if ($name = $this->checkProperty('get', $method)) { | ||
$value = $this->$name; | ||
} | ||
} | ||
|
||
return $value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright (C) 2015-2018 Libre Informatique | ||
* | ||
* This file is licensed under the GNU LGPL v3. | ||
* For the full copyright and license information, please view the LICENSE.md | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace PiaApi\DataExchange\Descriptor; | ||
|
||
use JMS\Serializer\Annotation as JMS; | ||
use Symfony\Component\Validator\Constraints as Assert; | ||
|
||
class AnswerDescriptor extends AbstractDescriptor | ||
{ | ||
/** | ||
* @JMS\Type("string") | ||
* @JMS\Groups({"Default", "Export"}) | ||
* @Assert\NotBlank | ||
* | ||
* @var string | ||
*/ | ||
protected $referenceTo = ''; | ||
|
||
/** | ||
* @JMS\Type("array") | ||
* @JMS\Groups({"Default", "Export"}) | ||
* @Assert\NotBlank | ||
* | ||
* @var array | ||
*/ | ||
protected $data = []; | ||
|
||
/** | ||
* @JMS\Type("DateTime") | ||
* @JMS\Groups({"Export"}) | ||
* | ||
* @var \DateTime|null | ||
*/ | ||
protected $createdAt = ''; | ||
|
||
/** | ||
* @JMS\Type("DateTime") | ||
* @JMS\Groups({"Export"}) | ||
* | ||
* @var \DateTime|null | ||
*/ | ||
protected $updatedAt = ''; | ||
|
||
public function __construct( | ||
string $referenceTo, | ||
array $data, | ||
\DateTime $createdAt, | ||
\DateTime $updatedAt | ||
) { | ||
$this->referenceTo = $referenceTo; | ||
$this->data = $data; | ||
$this->createdAt = $createdAt; | ||
$this->updatedAt = $updatedAt; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright (C) 2015-2018 Libre Informatique | ||
* | ||
* This file is licensed under the GNU LGPL v3. | ||
* For the full copyright and license information, please view the LICENSE.md | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace PiaApi\DataExchange\Descriptor; | ||
|
||
use JMS\Serializer\Annotation as JMS; | ||
use Symfony\Component\Validator\Constraints as Assert; | ||
|
||
class DataTypeDescriptor extends AbstractDescriptor | ||
{ | ||
/** | ||
* @JMS\Type("string") | ||
* @JMS\Groups({"Default", "Export"}) | ||
* @Assert\NotBlank | ||
* | ||
* @var string | ||
*/ | ||
protected $reference = ''; | ||
|
||
/** | ||
* @JMS\Type("string") | ||
* @JMS\Groups({"Default", "Export"}) | ||
* | ||
* @var string|null | ||
*/ | ||
protected $data = ''; | ||
|
||
/** | ||
* @JMS\Type("string") | ||
* @JMS\Groups({"Default", "Export"}) | ||
* | ||
* @var string|null | ||
*/ | ||
protected $retentionPeriod = ''; | ||
|
||
/** | ||
* @JMS\Type("boolean") | ||
* @JMS\Groups({"Default", "Export"}) | ||
* | ||
* @var bool | ||
*/ | ||
protected $sensitive = false; | ||
|
||
public function __construct( | ||
string $reference, | ||
string $data = null, | ||
string $retentionPeriod = null, | ||
bool $sensitive = false | ||
) { | ||
$this->reference = $reference; | ||
$this->data = $data; | ||
$this->retentionPeriod = $retentionPeriod; | ||
$this->sensitive = $sensitive; | ||
} | ||
} |
Oops, something went wrong.