-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 in DEV-MO/shopware5-module from hotfix/ets-27-…
…ratepay-plugin-prevents-customer-registration to release/5.2.3 * commit '18cb1e2a5e77a168d46b7e46ca2f71c8c3c13bfb': [ETS-27] fix missing method by using AddressWrapper hotfix/ets-27-ratepay-plugin-prevents-customer-registration more tests more tests tests add some tests hotfix/ets-27-ratepay-plugin-prevents-customer-registration add support for proxy classes hotfix/ets-27-ratepay-plugin-prevents-customer-registration
- Loading branch information
Showing
18 changed files
with
773 additions
and
97 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
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,52 @@ | ||
<?php | ||
|
||
namespace RpayRatePay\Component\Model; | ||
|
||
|
||
|
||
/** | ||
* Class ShopwareAddressWrapper | ||
* @package RpayRatePay\Component\Model | ||
*/ | ||
class ShopwareAddressWrapper | ||
{ | ||
/** @var object */ | ||
private $address; | ||
|
||
/** @var \Shopware\Components\Model\ModelManager */ | ||
private $em; | ||
|
||
/** @var string */ | ||
private $addressClass; | ||
|
||
|
||
/** | ||
* ShopwareAddressWrapper constructor. | ||
* @param object $address | ||
* @param \Shopware\Components\Model\ModelManager $em | ||
*/ | ||
public function __construct($address, $em) | ||
{ | ||
$this->address = $address; | ||
$this->em = $em; | ||
$this->addressClass = get_class($address); | ||
} | ||
|
||
/** | ||
* @return \Shopware\Models\Country\Country | ||
* @throws \Exception | ||
*/ | ||
public function getCountry() | ||
{ | ||
if (method_exists($this->address, 'getCountry')) { | ||
return $this->address->getCountry(); | ||
} | ||
|
||
if (method_exists($this->address, 'getCountryId')) { | ||
return $this->em->find('Shopware\Models\Country\Country', $this->address->getCountryId()); | ||
} | ||
|
||
throw new \Exception('False object type sent to ShopwareAddressWrapper'); | ||
} | ||
|
||
} |
Oops, something went wrong.