Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import updates #54

Closed
wants to merge 10 commits into from
Closed
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
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions src/AppBundle/Import/Importer/Merrick/Identity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace AppBundle\Import\Importer\Merrick;

use AppBundle\Core\AccountManager;
use AppBundle\Import\Importer\Merrick;
use AppBundle\Import\Segment\Merrick\Identity as Segment;
use As3\SymfonyData\Import\PersisterInterface;
use As3\SymfonyData\Import\SourceInterface;

/**
* Imports customers from Merrick data
*
* @author Josh Worden <[email protected]>
*/
class Identity extends Merrick
{
/**
* {@inheritdoc}
*/
public function __construct(AccountManager $accountManager, PersisterInterface $persister, SourceInterface $source)
{
parent::__construct($accountManager, $persister, $source);
$source->setDatabase('merrick');

// Identity data
$this->segments[] = new Segment\Account($this, $source);
$this->segments[] = new Segment\External($this, $source);
$this->segments[] = new Segment\Internal($this, $source);
$this->segments[] = new Segment\AccountEmail($this, $source);
}

/**
* {@inheritdoc}
*/
public function getKey()
{
return 'merrick_identity';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use AppBundle\Core\AccountManager;
use AppBundle\Import\Importer\Merrick;
use AppBundle\Import\Segment\Merrick\Customer as Segment;
use AppBundle\Import\Segment\Merrick\IdentityData as Segment;
use As3\SymfonyData\Import\PersisterInterface;
use As3\SymfonyData\Import\SourceInterface;

Expand All @@ -13,7 +13,7 @@
*
* @author Josh Worden <[email protected]>
*/
class Customer extends Merrick
class IdentityData extends Merrick
{
/**
* {@inheritdoc}
Expand All @@ -23,21 +23,21 @@ public function __construct(AccountManager $accountManager, PersisterInterface $
parent::__construct($accountManager, $persister, $source);
$source->setDatabase('merrick');

// Customer data
$this->segments[] = new Segment\Model\CustomerAccount($this, $source);
$this->segments[] = new Segment\Model\CustomerIdentity($this, $source);
$this->segments[] = new Segment\Model\CustomerAddress($this, $source);
$this->segments[] = new Segment\Model\CustomerEmail($this, $source);
// Input submissions
$this->segments[] = new Segment\InquiryRmi($this, $source);

// Demographics
$this->segments[] = new Segment\Model\CustomerAnswer($this, $source);
// Input Answers
$this->segments[] = new Segment\Answer($this, $source);
$this->segments[] = new Segment\InputAnswerOmeda($this, $source);
$this->segments[] = new Segment\InputAnswerComments($this, $source);
$this->segments[] = new Segment\InputAnswerPurchaseIntent($this, $source);
}

/**
* {@inheritdoc}
*/
public function getKey()
{
return 'merrick_customer';
return 'merrick_identity_data';
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use AppBundle\Import\Segment\Merrick;

abstract class Customer extends Merrick
abstract class Identity extends Merrick
{
/**
* {@inheritdoc}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php

namespace AppBundle\Import\Segment\Merrick\Customer\Model;
namespace AppBundle\Import\Segment\Merrick\Identity;

use AppBundle\Import\Segment\Merrick\Customer;
use AppBundle\Import\Segment\Merrick\Identity;

class CustomerAccount extends Customer
class Account extends Identity
{
/**
* {@inheritdoc}
*/
public function getKey()
{
return 'merrick_customer_model_customer_account';
return 'merrick_customer_identity_account';
}

/**
Expand All @@ -23,8 +23,7 @@ protected function formatModel(array $doc)
return;
}

$transformer = new Transformer\Customer();
$transformer->define('legacy.email', 'email', 'strtolower');
$transformer = new Transformer\Account();
return $transformer->toApp($doc);
}

Expand All @@ -46,7 +45,7 @@ protected function getCriteria()
*/
protected function getModelType()
{
return 'customer-account';
return 'identity-account';
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace AppBundle\Import\Segment\Merrick\Customer\Model;
namespace AppBundle\Import\Segment\Merrick\Identity;

use AppBundle\Import\Segment\Merrick\Customer;
use AppBundle\Import\Segment\Merrick\Identity;

class CustomerEmail extends Customer
class AccountEmail extends Identity
{
/**
* {@inheritdoc}
Expand All @@ -19,7 +19,7 @@ public function count()
*/
public function getKey()
{
return 'merrick_customer_model_customer_email';
return 'merrick_customer_identity_account_email';
}

/**
Expand All @@ -35,7 +35,7 @@ protected function formatModel(array $doc)
'value' => $doc['legacy']['email'],
'account' => $doc['_id']
];
$transformer = new Transformer\CustomerEmail();
$transformer = new Transformer\AccountEmail();
return $transformer->toApp($email);
}

Expand All @@ -44,7 +44,7 @@ protected function formatModel(array $doc)
*/
protected function getCollection()
{
return 'customer';
return 'identity';
}

/**
Expand All @@ -60,14 +60,14 @@ protected function getDocuments($limit = 200, $skip = 0)
*/
protected function getCriteria()
{
return ['legacy.email' => ['$exists' => true]];
return ['_type' => 'identity-account'];
}

/**
* {@inheritdoc}
*/
protected function getModelType()
{
return 'customer-email';
return 'identity-account-email';
}
}
Loading