Prevent duplication of data in factories
[MAILPOET-3627]
This commit is contained in:
@@ -253,7 +253,7 @@ class Newsletter {
|
|||||||
*/
|
*/
|
||||||
public function withSegments(array $segments) {
|
public function withSegments(array $segments) {
|
||||||
foreach ($segments as $segment) {
|
foreach ($segments as $segment) {
|
||||||
$this->segments[] = $segment;
|
$this->segments[$segment->getId()] = $segment;
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@@ -279,7 +279,7 @@ class Newsletter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function withSubscriber(SubscriberEntity $subscriber, array $data = []) {
|
public function withSubscriber(SubscriberEntity $subscriber, array $data = []) {
|
||||||
$this->taskSubscribers[] = array_merge([
|
$this->taskSubscribers[$subscriber->getId()] = array_merge([
|
||||||
'subscriber' => $subscriber,
|
'subscriber' => $subscriber,
|
||||||
'processed' => 1,
|
'processed' => 1,
|
||||||
'failed' => 0,
|
'failed' => 0,
|
||||||
|
@@ -74,7 +74,9 @@ class Subscriber {
|
|||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function withSegments(array $segments) {
|
public function withSegments(array $segments) {
|
||||||
$this->segments = array_merge($this->segments, $segments);
|
foreach ($segments as $segment) {
|
||||||
|
$this->segments[$segment->getId()] = $segment;
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user