| @@ 583-616 (lines=34) @@ | ||
| 580 | * @throws PropelException |
|
| 581 | * @see doSave() |
|
| 582 | */ |
|
| 583 | public function save(ConnectionInterface $con = null) |
|
| 584 | { |
|
| 585 | if ($this->isDeleted()) { |
|
| 586 | throw new PropelException("You cannot save an object that has been deleted."); |
|
| 587 | } |
|
| 588 | ||
| 589 | if ($con === null) { |
|
| 590 | $con = Propel::getServiceContainer()->getWriteConnection(TaskTableMap::DATABASE_NAME); |
|
| 591 | } |
|
| 592 | ||
| 593 | return $con->transaction(function () use ($con) { |
|
| 594 | $isInsert = $this->isNew(); |
|
| 595 | $ret = $this->preSave($con); |
|
| 596 | if ($isInsert) { |
|
| 597 | $ret = $ret && $this->preInsert($con); |
|
| 598 | } else { |
|
| 599 | $ret = $ret && $this->preUpdate($con); |
|
| 600 | } |
|
| 601 | if ($ret) { |
|
| 602 | $affectedRows = $this->doSave($con); |
|
| 603 | if ($isInsert) { |
|
| 604 | $this->postInsert($con); |
|
| 605 | } else { |
|
| 606 | $this->postUpdate($con); |
|
| 607 | } |
|
| 608 | $this->postSave($con); |
|
| 609 | TaskTableMap::addInstanceToPool($this); |
|
| 610 | } else { |
|
| 611 | $affectedRows = 0; |
|
| 612 | } |
|
| 613 | ||
| 614 | return $affectedRows; |
|
| 615 | }); |
|
| 616 | } |
|
| 617 | ||
| 618 | /** |
|
| 619 | * Performs the work of inserting or updating the row in the database. |
|
| @@ 739-772 (lines=34) @@ | ||
| 736 | * @throws PropelException |
|
| 737 | * @see doSave() |
|
| 738 | */ |
|
| 739 | public function save(ConnectionInterface $con = null) |
|
| 740 | { |
|
| 741 | if ($this->isDeleted()) { |
|
| 742 | throw new PropelException("You cannot save an object that has been deleted."); |
|
| 743 | } |
|
| 744 | ||
| 745 | if ($con === null) { |
|
| 746 | $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); |
|
| 747 | } |
|
| 748 | ||
| 749 | return $con->transaction(function () use ($con) { |
|
| 750 | $isInsert = $this->isNew(); |
|
| 751 | $ret = $this->preSave($con); |
|
| 752 | if ($isInsert) { |
|
| 753 | $ret = $ret && $this->preInsert($con); |
|
| 754 | } else { |
|
| 755 | $ret = $ret && $this->preUpdate($con); |
|
| 756 | } |
|
| 757 | if ($ret) { |
|
| 758 | $affectedRows = $this->doSave($con); |
|
| 759 | if ($isInsert) { |
|
| 760 | $this->postInsert($con); |
|
| 761 | } else { |
|
| 762 | $this->postUpdate($con); |
|
| 763 | } |
|
| 764 | $this->postSave($con); |
|
| 765 | UserTableMap::addInstanceToPool($this); |
|
| 766 | } else { |
|
| 767 | $affectedRows = 0; |
|
| 768 | } |
|
| 769 | ||
| 770 | return $affectedRows; |
|
| 771 | }); |
|
| 772 | } |
|
| 773 | ||
| 774 | /** |
|
| 775 | * Performs the work of inserting or updating the row in the database. |
|