-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Adam Wysocki
committed
Nov 14, 2024
1 parent
3bb10ba
commit b62021f
Showing
27 changed files
with
526 additions
and
209 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
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,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tpay\Magento2\Model; | ||
|
||
use Tpay\Magento2\Model\Api\AliasRepositoryInterface; | ||
use Tpay\Magento2\Model\Api\Data\AliasInterface; | ||
use Tpay\Magento2\Model\ResourceModel\Alias as AliasResourceModel; | ||
|
||
class AliasRepository implements AliasRepositoryInterface | ||
{ | ||
/** @var AliasFactory */ | ||
protected $aliasFactory; | ||
|
||
/** @var AliasResourceModel */ | ||
protected $aliasResourceModel; | ||
|
||
public function __construct(AliasFactory $aliasFactory, AliasResourceModel $aliasResourceModel) | ||
{ | ||
$this->aliasFactory = $aliasFactory; | ||
$this->aliasResourceModel = $aliasResourceModel; | ||
} | ||
|
||
public function findByCustomerId(int $customerId): ?AliasInterface | ||
{ | ||
$alias = $this->aliasFactory->create(); | ||
$this->aliasResourceModel->load($alias, $customerId, 'cli_id'); | ||
|
||
return $alias; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function save(AliasInterface $alias): void | ||
{ | ||
$this->aliasResourceModel->save($alias); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function remove(AliasInterface $alias): void | ||
{ | ||
$this->aliasResourceModel->delete($alias); | ||
} | ||
} |
Oops, something went wrong.