Code Duplication    Length = 34-34 lines in 3 locations

packages/core/src/Models/Task/Base/Task.php 1 location

@@ 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.

packages/selfprice/src/Models/Selfprice/Base/Selfprice.php 1 location

@@ 609-642 (lines=34) @@
606
     * @throws PropelException
607
     * @see doSave()
608
     */
609
    public function save(ConnectionInterface $con = null)
610
    {
611
        if ($this->isDeleted()) {
612
            throw new PropelException("You cannot save an object that has been deleted.");
613
        }
614
615
        if ($con === null) {
616
            $con = Propel::getServiceContainer()->getWriteConnection(SelfpriceTableMap::DATABASE_NAME);
617
        }
618
619
        return $con->transaction(function () use ($con) {
620
            $isInsert = $this->isNew();
621
            $ret = $this->preSave($con);
622
            if ($isInsert) {
623
                $ret = $ret && $this->preInsert($con);
624
            } else {
625
                $ret = $ret && $this->preUpdate($con);
626
            }
627
            if ($ret) {
628
                $affectedRows = $this->doSave($con);
629
                if ($isInsert) {
630
                    $this->postInsert($con);
631
                } else {
632
                    $this->postUpdate($con);
633
                }
634
                $this->postSave($con);
635
                SelfpriceTableMap::addInstanceToPool($this);
636
            } else {
637
                $affectedRows = 0;
638
            }
639
640
            return $affectedRows;
641
        });
642
    }
643
644
    /**
645
     * Performs the work of inserting or updating the row in the database.

packages/core/src/Models/User/Base/User.php 1 location

@@ 767-800 (lines=34) @@
764
     * @throws PropelException
765
     * @see doSave()
766
     */
767
    public function save(ConnectionInterface $con = null)
768
    {
769
        if ($this->isDeleted()) {
770
            throw new PropelException("You cannot save an object that has been deleted.");
771
        }
772
773
        if ($con === null) {
774
            $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME);
775
        }
776
777
        return $con->transaction(function () use ($con) {
778
            $isInsert = $this->isNew();
779
            $ret = $this->preSave($con);
780
            if ($isInsert) {
781
                $ret = $ret && $this->preInsert($con);
782
            } else {
783
                $ret = $ret && $this->preUpdate($con);
784
            }
785
            if ($ret) {
786
                $affectedRows = $this->doSave($con);
787
                if ($isInsert) {
788
                    $this->postInsert($con);
789
                } else {
790
                    $this->postUpdate($con);
791
                }
792
                $this->postSave($con);
793
                UserTableMap::addInstanceToPool($this);
794
            } else {
795
                $affectedRows = 0;
796
            }
797
798
            return $affectedRows;
799
        });
800
    }
801
802
    /**
803
     * Performs the work of inserting or updating the row in the database.