| @@ 1502-1523 (lines=22) @@ | ||
| 1499 | * @param ConnectionInterface $con Optional connection object |
|
| 1500 | * @return $this|ChildInstance The current object (for fluent API support) |
|
| 1501 | */ |
|
| 1502 | public function setConnections(Collection $connections, ConnectionInterface $con = null) |
|
| 1503 | { |
|
| 1504 | /** @var ChildConnection[] $connectionsToDelete */ |
|
| 1505 | $connectionsToDelete = $this->getConnections(new Criteria(), $con)->diff($connections); |
|
| 1506 | ||
| 1507 | ||
| 1508 | $this->connectionsScheduledForDeletion = $connectionsToDelete; |
|
| 1509 | ||
| 1510 | foreach ($connectionsToDelete as $connectionRemoved) { |
|
| 1511 | $connectionRemoved->setInstance(null); |
|
| 1512 | } |
|
| 1513 | ||
| 1514 | $this->collConnections = null; |
|
| 1515 | foreach ($connections as $connection) { |
|
| 1516 | $this->addConnection($connection); |
|
| 1517 | } |
|
| 1518 | ||
| 1519 | $this->collConnections = $connections; |
|
| 1520 | $this->collConnectionsPartial = false; |
|
| 1521 | ||
| 1522 | return $this; |
|
| 1523 | } |
|
| 1524 | ||
| 1525 | /** |
|
| 1526 | * Returns the number of related Connection objects. |
|
| @@ 1387-1408 (lines=22) @@ | ||
| 1384 | * @param ConnectionInterface $con Optional connection object |
|
| 1385 | * @return $this|ChildUser The current object (for fluent API support) |
|
| 1386 | */ |
|
| 1387 | public function setConnections(Collection $connections, ConnectionInterface $con = null) |
|
| 1388 | { |
|
| 1389 | /** @var ChildConnection[] $connectionsToDelete */ |
|
| 1390 | $connectionsToDelete = $this->getConnections(new Criteria(), $con)->diff($connections); |
|
| 1391 | ||
| 1392 | ||
| 1393 | $this->connectionsScheduledForDeletion = $connectionsToDelete; |
|
| 1394 | ||
| 1395 | foreach ($connectionsToDelete as $connectionRemoved) { |
|
| 1396 | $connectionRemoved->setUser(null); |
|
| 1397 | } |
|
| 1398 | ||
| 1399 | $this->collConnections = null; |
|
| 1400 | foreach ($connections as $connection) { |
|
| 1401 | $this->addConnection($connection); |
|
| 1402 | } |
|
| 1403 | ||
| 1404 | $this->collConnections = $connections; |
|
| 1405 | $this->collConnectionsPartial = false; |
|
| 1406 | ||
| 1407 | return $this; |
|
| 1408 | } |
|
| 1409 | ||
| 1410 | /** |
|
| 1411 | * Returns the number of related Connection objects. |
|
| @@ 1637-1658 (lines=22) @@ | ||
| 1634 | * @param ConnectionInterface $con Optional connection object |
|
| 1635 | * @return $this|ChildUser The current object (for fluent API support) |
|
| 1636 | */ |
|
| 1637 | public function setSubscriptions(Collection $subscriptions, ConnectionInterface $con = null) |
|
| 1638 | { |
|
| 1639 | /** @var ChildSubscription[] $subscriptionsToDelete */ |
|
| 1640 | $subscriptionsToDelete = $this->getSubscriptions(new Criteria(), $con)->diff($subscriptions); |
|
| 1641 | ||
| 1642 | ||
| 1643 | $this->subscriptionsScheduledForDeletion = $subscriptionsToDelete; |
|
| 1644 | ||
| 1645 | foreach ($subscriptionsToDelete as $subscriptionRemoved) { |
|
| 1646 | $subscriptionRemoved->setUser(null); |
|
| 1647 | } |
|
| 1648 | ||
| 1649 | $this->collSubscriptions = null; |
|
| 1650 | foreach ($subscriptions as $subscription) { |
|
| 1651 | $this->addSubscription($subscription); |
|
| 1652 | } |
|
| 1653 | ||
| 1654 | $this->collSubscriptions = $subscriptions; |
|
| 1655 | $this->collSubscriptionsPartial = false; |
|
| 1656 | ||
| 1657 | return $this; |
|
| 1658 | } |
|
| 1659 | ||
| 1660 | /** |
|
| 1661 | * Returns the number of related Subscription objects. |
|