BitBagCommerce /
SyliusMolliePlugin
| 1 | <?php |
||
| 2 | |||
| 3 | /* |
||
| 4 | * This file has been created by developers from BitBag. |
||
| 5 | * Feel free to contact us once you face any issues or want to start |
||
| 6 | * You can find more information about us on https://bitbag.io and write us |
||
| 7 | * an email on [email protected]. |
||
| 8 | */ |
||
| 9 | |||
| 10 | declare(strict_types=1); |
||
| 11 | |||
| 12 | namespace BitBag\SyliusMolliePlugin\Entity; |
||
| 13 | |||
| 14 | use Sylius\Component\Core\Model\OrderInterface; |
||
|
0 ignored issues
–
show
|
|||
| 15 | |||
| 16 | class Subscription implements SubscriptionInterface |
||
| 17 | { |
||
| 18 | /** @var int|null */ |
||
| 19 | protected $id; |
||
| 20 | |||
| 21 | /** @var OrderInterface */ |
||
| 22 | protected $order; |
||
| 23 | |||
| 24 | /** @var string|null */ |
||
| 25 | protected $subscriptionId; |
||
| 26 | |||
| 27 | /** @var string|null */ |
||
| 28 | protected $customerId; |
||
| 29 | |||
| 30 | /** @var string */ |
||
| 31 | protected $state = SubscriptionInterface::STATE_NEW; |
||
| 32 | |||
| 33 | public function getId(): ?int |
||
| 34 | { |
||
| 35 | return $this->id; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function getOrder(): OrderInterface |
||
| 39 | { |
||
| 40 | return $this->order; |
||
| 41 | } |
||
| 42 | |||
| 43 | public function setOrder(OrderInterface $order): void |
||
| 44 | { |
||
| 45 | $this->order = $order; |
||
| 46 | } |
||
| 47 | |||
| 48 | public function getSubscriptionId(): ?string |
||
| 49 | { |
||
| 50 | return $this->subscriptionId; |
||
| 51 | } |
||
| 52 | |||
| 53 | public function setSubscriptionId(?string $subscriptionId): void |
||
| 54 | { |
||
| 55 | $this->subscriptionId = $subscriptionId; |
||
| 56 | } |
||
| 57 | |||
| 58 | public function getState(): string |
||
| 59 | { |
||
| 60 | return $this->state; |
||
| 61 | } |
||
| 62 | |||
| 63 | public function setState(string $state): void |
||
| 64 | { |
||
| 65 | $this->state = $state; |
||
| 66 | } |
||
| 67 | |||
| 68 | public function getCustomerId(): ?string |
||
| 69 | { |
||
| 70 | return $this->customerId; |
||
| 71 | } |
||
| 72 | |||
| 73 | public function setCustomerId(?string $customerId): void |
||
| 74 | { |
||
| 75 | $this->customerId = $customerId; |
||
| 76 | } |
||
| 77 | } |
||
| 78 |
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: