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

Commit

Permalink
APOLLO-3348 ripped out exchangeArray
Browse files Browse the repository at this point in the history
  • Loading branch information
brettminnie committed Jun 27, 2014
1 parent 2de3695 commit 0a3039d
Show file tree
Hide file tree
Showing 29 changed files with 10 additions and 620 deletions.
6 changes: 0 additions & 6 deletions src/Opg/Common/Model/Entity/EntityInterface.php
Expand Up @@ -16,10 +16,4 @@ interface EntityInterface extends InputFilterAwareInterface
*/
public function toArray($exposeClassname = false);

/**
* @param array $data
*
* @return EntityInterface
*/
public function exchangeArray(array $data);
}
3 changes: 0 additions & 3 deletions src/Opg/Core/Model/Entity/CaseItem/BusinessRule.php
Expand Up @@ -2,11 +2,9 @@
namespace Opg\Core\Model\Entity\CaseItem;

use Opg\Common\Model\Entity\EntityInterface;
use Opg\Common\Model\Entity\Traits\ExchangeArray;
use Opg\Common\Model\Entity\Traits\ToArray;
use Doctrine\ORM\Mapping as ORM;
use \Zend\InputFilter\InputFilter;
use \Zend\InputFilter\Factory as InputFactory;
use JMS\Serializer\Annotation\Exclude;
use JMS\Serializer\Annotation\ReadOnly;
use JMS\Serializer\Annotation\Type;
Expand All @@ -27,7 +25,6 @@ class BusinessRule implements EntityInterface, \IteratorAggregate
use \Opg\Common\Model\Entity\Traits\InputFilter;
use \Opg\Common\Model\Entity\Traits\IteratorAggregate;
use ToArray;
use ExchangeArray;

/**
* @ORM\Column(type = "integer", options = {"unsigned": true}) @ORM\GeneratedValue(strategy = "AUTO") @ORM\Id
Expand Down
50 changes: 0 additions & 50 deletions src/Opg/Core/Model/Entity/CaseItem/CaseItem.php
Expand Up @@ -9,7 +9,6 @@
use Opg\Common\Model\Entity\HasCorrespondenceInterface;
use Opg\Common\Model\Entity\HasRagRating;
use Opg\Common\Model\Entity\HasUidInterface;
use Opg\Common\Model\Entity\Traits\ExchangeArray;
use Opg\Common\Model\Entity\Traits\InputFilter;
use Opg\Common\Model\Entity\Traits\HasNotes;
use Opg\Common\Model\Entity\Traits\HasCorrespondence;
Expand Down Expand Up @@ -41,9 +40,6 @@ abstract class CaseItem implements EntityInterface, \IteratorAggregate, CaseItem
use HasNotes;
use UniqueIdentifier;
use InputFilter;
use ExchangeArray {
exchangeArray as exchangeArrayTrait;
}
use HasCorrespondence;

const APPLICATION_TYPE_CLASSIC = 0;
Expand Down Expand Up @@ -431,52 +427,6 @@ public function setDocuments(ArrayCollection $documents)
return $this;
}

/**
* @TODO is this still required?
*
* @param array $data
*
* @return CaseItem
*/
public function exchangeArray(array $data)
{
$this->exchangeArrayTrait($data);

if (!empty($data['assignedUser'])) {
$assignedUser = new User();
$assignedUser->exchangeArray($data['assignedUser']);
$this->setAssignedUser($assignedUser);
}

if (!empty($data['tasks'])) {
$this->tasks = null;
foreach ($data['tasks'] as $taskData) {
$newTask = new Task();
$this->addTask(is_object($taskData) ? $taskData : $newTask->exchangeArray($taskData));
}
}

if (!empty($data['notes'])) {
$this->notes = null;
foreach ($data['notes'] as $noteData) {
$newNote = new Note();
$this->addNote(is_object($noteData) ? $noteData : $newNote->exchangeArray($noteData));
}
}

if (!empty($data['documents'])) {
$this->documents = null;
foreach ($data['documents'] as $documentData) {
$newDocument = new Document();
$this->addDocument(
is_object($documentData) ? $documentData : $newDocument->exchangeArray($documentData)
);
}
}

return $this;
}

/**
* @return \ArrayIterator
*/
Expand Down
16 changes: 1 addition & 15 deletions src/Opg/Core/Model/Entity/CaseItem/Lpa/Party/Attorney.php
Expand Up @@ -3,7 +3,6 @@

use Opg\Core\Model\Entity\CaseItem\Lpa\Traits\RelationshipToDonor;
use Zend\InputFilter\InputFilterInterface;
use Opg\Common\Model\Entity\Traits\ExchangeArray;
use Opg\Core\Model\Entity\CaseItem\Lpa\Traits\Company;
use Opg\Common\Model\Entity\Traits\ToArray;
use Doctrine\ORM\Mapping as ORM;
Expand All @@ -21,10 +20,7 @@
*/
class Attorney extends AttorneyAbstract implements PartyInterface, HasRelationshipToDonor
{
use ToArray {
toArray as traitToArray;
}
use ExchangeArray;
use ToArray;
use RelationshipToDonor;

/**
Expand Down Expand Up @@ -117,16 +113,6 @@ public function getInputFilter()
return $this->inputFilter;
}

/**
* @param bool $exposeClassname
*
* @return array
*/
public function toArray($exposeClassname = true)
{
return $this->traitToArray($exposeClassname);
}

/**
* @param \DateTime $lpa002SignatureDate
*
Expand Down
@@ -1,7 +1,6 @@
<?php
namespace Opg\Core\Model\Entity\CaseItem\Lpa\Party;

use Opg\Common\Model\Entity\Traits\ExchangeArray;
use Opg\Common\Model\Entity\Traits\ToArray;
use Opg\Core\Model\Entity\CaseItem\Lpa\Traits\RelationshipToDonor;
use Opg\Core\Model\Entity\Person\Person as BasePerson;
Expand All @@ -17,10 +16,7 @@
*/
class CertificateProvider extends BasePerson implements PartyInterface, HasRelationshipToDonor
{
use ToArray {
toArray as toTraitArray;
}
use ExchangeArray;
use ToArray;
use RelationshipToDonor;

/**
Expand Down Expand Up @@ -83,16 +79,6 @@ public function setStatement($statement)
return $this;
}

/**
* @param bool $exposeClassName
*
* @return array
*/
public function toArray($exposeClassName = true)
{
return $this->toTraitArray($exposeClassName);
}

/**
* @param string $certificateProviderSkills
*
Expand Down
16 changes: 1 addition & 15 deletions src/Opg/Core/Model/Entity/CaseItem/Lpa/Party/Correspondent.php
Expand Up @@ -2,7 +2,6 @@
namespace Opg\Core\Model\Entity\CaseItem\Lpa\Party;

use Opg\Common\Model\Entity\EntityInterface;
use Opg\Common\Model\Entity\Traits\ExchangeArray;
use Opg\Core\Model\Entity\CaseItem\Lpa\Traits\RelationshipToDonor;
use Opg\Core\Model\Entity\Person\Person as BasePerson;
use Opg\Core\Model\Entity\CaseItem\Lpa\Traits\Company;
Expand All @@ -20,22 +19,9 @@
class Correspondent extends BasePerson implements PartyInterface, EntityInterface, HasRelationshipToDonor
{
use Company;
use ToArray {
toArray as toTraitArray;
}
use ExchangeArray;
use ToArray;
use RelationshipToDonor;

/**
* @param bool $exposeClassName
*
* @return array
*/
public function toArray($exposeClassName = true)
{
return $this->toTraitArray($exposeClassName);
}

/**
* @return InputFilterInterface
* @codeCoverageIgnore
Expand Down
18 changes: 2 additions & 16 deletions src/Opg/Core/Model/Entity/CaseItem/Lpa/Party/Donor.php
@@ -1,10 +1,8 @@
<?php
namespace Opg\Core\Model\Entity\CaseItem\Lpa\Party;

use Opg\Common\Model\Entity\Traits\ExchangeArray;
use Zend\InputFilter\InputFilter;
use Opg\Common\Model\Entity\Traits\ToArray;
use Zend\InputFilter\Factory as InputFactory;
use Opg\Core\Model\Entity\Person\Person as BasePerson;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\Exclude;
Expand All @@ -13,6 +11,7 @@
use JMS\Serializer\Annotation\Type;
use Opg\Common\Model\Entity\DateFormat as OPGDateFormat;


/**
* @ORM\Entity
*
Expand All @@ -21,10 +20,7 @@
*/
class Donor extends BasePerson implements PartyInterface
{
use ToArray {
toArray as traitToArray;
}
use ExchangeArray;
use ToArray;

/**
* @return InputFilter|InputFilterInterface
Expand Down Expand Up @@ -315,14 +311,4 @@ public function setNotesForPreviousLpa($notesForPreviousLpa)

return $this;
}

/**
* @param bool $exposeClassname
*
* @return array
*/
public function toArray($exposeClassname = true)
{
return $this->traitToArray($exposeClassname);
}
}
16 changes: 1 addition & 15 deletions src/Opg/Core/Model/Entity/CaseItem/Lpa/Party/NotifiedPerson.php
@@ -1,7 +1,6 @@
<?php
namespace Opg\Core\Model\Entity\CaseItem\Lpa\Party;

use Opg\Common\Model\Entity\Traits\ExchangeArray;
use Opg\Core\Model\Entity\CaseItem\Lpa\Traits\RelationshipToDonor;
use Opg\Core\Model\Entity\Person\Person as BasePerson;
use Opg\Common\Model\Entity\Traits\ToArray;
Expand All @@ -20,10 +19,7 @@
*/
class NotifiedPerson extends BasePerson implements PartyInterface, HasRelationshipToDonor
{
use ToArray {
toArray as toTraitArray;
}
use ExchangeArray;
use ToArray;
use RelationshipToDonor;

/**
Expand Down Expand Up @@ -87,16 +83,6 @@ public function getNotifiedDateString()
return '';
}

/**
* @param bool $exposeClassName
*
* @return array
*/
public function toArray($exposeClassName = true)
{
return $this->toTraitArray($exposeClassName);
}

/**
* @return InputFilterInterface
*/
Expand Down
@@ -1,7 +1,6 @@
<?php
namespace Opg\Core\Model\Entity\CaseItem\Lpa\Party;

use Opg\Common\Model\Entity\Traits\ExchangeArray;
use Opg\Common\Model\Entity\Traits\ToArray;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\Accessor;
Expand All @@ -16,10 +15,7 @@
*/
class ReplacementAttorney extends AttorneyAbstract
{
use ExchangeArray;
use ToArray {
toArray as traitToArray;
}
use ToArray;

/**
* @ORM\Column(type="date", nullable=true)
Expand Down
Expand Up @@ -2,7 +2,6 @@
namespace Opg\Core\Model\Entity\CaseItem\Lpa\Party;

use Doctrine\ORM\Mapping as ORM;
use Opg\Common\Model\Entity\Traits\ExchangeArray;
use Opg\Common\Model\Entity\Traits\ToArray;

/**
Expand All @@ -14,7 +13,6 @@
class TrustCorporation extends AttorneyAbstract
{
use ToArray;
use ExchangeArray;

const AS_ATTORNEY = 'Attorney';
const AS_REPLACEMENT_ATTORNEY = 'Replacement Attorney';
Expand Down
25 changes: 0 additions & 25 deletions src/Opg/Core/Model/Entity/CaseItem/Note/Note.php
Expand Up @@ -286,31 +286,6 @@ public function getPerson()
return $this->person;
}

/**
* @param array $data
*
* @return Note
*/
public function exchangeArray(array $data)
{
empty($data['id']) ? : $this->setId($data['id']);
empty($data['type']) ? : $this->setType($data['type']);

if (!empty($data['user'])) {
$createdByUser = new User();
$createdByUser->exchangeArray($data['user']);

$this->setCreatedByUser($createdByUser);
}

empty($data['status']) ? : $this->setStatus($data['status']);
empty($data['description']) ? : $this->setDescription($data['description']);
empty($data['name']) ? : $this->setName($data['name']);
empty($data['createdTime']) ? : $this->setCreatedTime($data['createdTime']);

return $this;
}

/**
* @throws \Opg\Common\Exception\UnusedException
* @return InputFilter
Expand Down
2 changes: 0 additions & 2 deletions src/Opg/Core/Model/Entity/CaseItem/Page/Page.php
Expand Up @@ -3,7 +3,6 @@

use Doctrine\ORM\Mapping as ORM;
use Opg\Common\Model\Entity\EntityInterface;
use Opg\Common\Model\Entity\Traits\ExchangeArray;
use Opg\Common\Model\Entity\Traits\ToArray;
use Opg\Core\Model\Entity\CaseItem\Document\Document;
use Zend\InputFilter\Factory as InputFactory;
Expand All @@ -22,7 +21,6 @@ class Page implements EntityInterface, \IteratorAggregate
{
use \Opg\Common\Model\Entity\Traits\InputFilter;
use ToArray;
use ExchangeArray;

/**
* @ORM\Column(type = "integer", options = {"unsigned": true}) @ORM\GeneratedValue(strategy = "AUTO") @ORM\Id
Expand Down

0 comments on commit 0a3039d

Please sign in to comment.