First commit
This commit is contained in:
15
packages/mmt/ddd-shared-kernel/ValueObjects/Price.php
Normal file
15
packages/mmt/ddd-shared-kernel/ValueObjects/Price.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace MMT\DDDSharedKernel\ValueObjects;
|
||||
|
||||
class Price extends ValueObject
|
||||
{
|
||||
public function __construct(
|
||||
private Money $money
|
||||
)
|
||||
{
|
||||
if($this->money->isNegative()) {
|
||||
throw new \InvalidArgumentException("The price cannot be negative");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user