-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add allow setting of extra data on factories instead of passing custo…
…m data on methods
- Loading branch information
1 parent
c7ffa65
commit f18725a
Showing
3 changed files
with
103 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace SilverCommerce\OrdersAdmin\Traits; | ||
|
||
trait ExtraData | ||
{ | ||
/** | ||
* Array of optional extra data that can be passed to this factory. | ||
* (and will be passed into @link LineItemFactory). | ||
* | ||
* The intention is to allow custom extensions to pass generic data | ||
* that can be accessed further down the stack | ||
* | ||
* @var array | ||
*/ | ||
protected $extra_data = []; | ||
|
||
public function getExtraData(): array | ||
{ | ||
return $this->extra_data; | ||
} | ||
|
||
public function setExtraData(array $data): self | ||
{ | ||
$this->extra_data = $data; | ||
return $this; | ||
} | ||
} |