Code Duplication    Length = 34-34 lines in 6 locations

src/cli/Database/Base/Channel.php 1 location

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

src/cli/Database/Base/Connection.php 1 location

@@ 728-761 (lines=34) @@
725
     * @throws PropelException
726
     * @see doSave()
727
     */
728
    public function save(ConnectionInterface $con = null)
729
    {
730
        if ($this->isDeleted()) {
731
            throw new PropelException("You cannot save an object that has been deleted.");
732
        }
733
734
        if ($con === null) {
735
            $con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME);
736
        }
737
738
        return $con->transaction(function () use ($con) {
739
            $isInsert = $this->isNew();
740
            $ret = $this->preSave($con);
741
            if ($isInsert) {
742
                $ret = $ret && $this->preInsert($con);
743
            } else {
744
                $ret = $ret && $this->preUpdate($con);
745
            }
746
            if ($ret) {
747
                $affectedRows = $this->doSave($con);
748
                if ($isInsert) {
749
                    $this->postInsert($con);
750
                } else {
751
                    $this->postUpdate($con);
752
                }
753
                $this->postSave($con);
754
                ConnectionTableMap::addInstanceToPool($this);
755
            } else {
756
                $affectedRows = 0;
757
            }
758
759
            return $affectedRows;
760
        });
761
    }
762
763
    /**
764
     * Performs the work of inserting or updating the row in the database.

src/cli/Database/Base/User.php 1 location

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

src/cli/Database/Base/Input.php 1 location

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

src/cli/Database/Base/Instance.php 1 location

@@ 573-606 (lines=34) @@
570
     * @throws PropelException
571
     * @see doSave()
572
     */
573
    public function save(ConnectionInterface $con = null)
574
    {
575
        if ($this->isDeleted()) {
576
            throw new PropelException("You cannot save an object that has been deleted.");
577
        }
578
579
        if ($con === null) {
580
            $con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME);
581
        }
582
583
        return $con->transaction(function () use ($con) {
584
            $isInsert = $this->isNew();
585
            $ret = $this->preSave($con);
586
            if ($isInsert) {
587
                $ret = $ret && $this->preInsert($con);
588
            } else {
589
                $ret = $ret && $this->preUpdate($con);
590
            }
591
            if ($ret) {
592
                $affectedRows = $this->doSave($con);
593
                if ($isInsert) {
594
                    $this->postInsert($con);
595
                } else {
596
                    $this->postUpdate($con);
597
                }
598
                $this->postSave($con);
599
                InstanceTableMap::addInstanceToPool($this);
600
            } else {
601
                $affectedRows = 0;
602
            }
603
604
            return $affectedRows;
605
        });
606
    }
607
608
    /**
609
     * Performs the work of inserting or updating the row in the database.

src/cli/Database/Base/Subscription.php 1 location

@@ 928-961 (lines=34) @@
925
     * @throws PropelException
926
     * @see doSave()
927
     */
928
    public function save(ConnectionInterface $con = null)
929
    {
930
        if ($this->isDeleted()) {
931
            throw new PropelException("You cannot save an object that has been deleted.");
932
        }
933
934
        if ($con === null) {
935
            $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME);
936
        }
937
938
        return $con->transaction(function () use ($con) {
939
            $isInsert = $this->isNew();
940
            $ret = $this->preSave($con);
941
            if ($isInsert) {
942
                $ret = $ret && $this->preInsert($con);
943
            } else {
944
                $ret = $ret && $this->preUpdate($con);
945
            }
946
            if ($ret) {
947
                $affectedRows = $this->doSave($con);
948
                if ($isInsert) {
949
                    $this->postInsert($con);
950
                } else {
951
                    $this->postUpdate($con);
952
                }
953
                $this->postSave($con);
954
                SubscriptionTableMap::addInstanceToPool($this);
955
            } else {
956
                $affectedRows = 0;
957
            }
958
959
            return $affectedRows;
960
        });
961
    }
962
963
    /**
964
     * Performs the work of inserting or updating the row in the database.