Code Duplication    Length = 38-38 lines in 5 locations

application/modules/core/models/Base/Route.php 1 location

@@ 703-740 (lines=38) @@
700
     * @throws PropelException
701
     * @see doSave()
702
     */
703
    public function save(ConnectionInterface $con = null)
704
    {
705
        if ($this->isDeleted()) {
706
            throw new PropelException("You cannot save an object that has been deleted.");
707
        }
708
709
        if ($this->alreadyInSave) {
710
            return 0;
711
        }
712
713
        if ($con === null) {
714
            $con = Propel::getServiceContainer()->getWriteConnection(RouteTableMap::DATABASE_NAME);
715
        }
716
717
        return $con->transaction(function () use ($con) {
718
            $ret = $this->preSave($con);
719
            $isInsert = $this->isNew();
720
            if ($isInsert) {
721
                $ret = $ret && $this->preInsert($con);
722
            } else {
723
                $ret = $ret && $this->preUpdate($con);
724
            }
725
            if ($ret) {
726
                $affectedRows = $this->doSave($con);
727
                if ($isInsert) {
728
                    $this->postInsert($con);
729
                } else {
730
                    $this->postUpdate($con);
731
                }
732
                $this->postSave($con);
733
                RouteTableMap::addInstanceToPool($this);
734
            } else {
735
                $affectedRows = 0;
736
            }
737
738
            return $affectedRows;
739
        });
740
    }
741
742
    /**
743
     * Performs the work of inserting or updating the row in the database.

application/modules/xbanners/models/Base/BannerImage.php 1 location

@@ 895-932 (lines=38) @@
892
     * @throws PropelException
893
     * @see doSave()
894
     */
895
    public function save(ConnectionInterface $con = null)
896
    {
897
        if ($this->isDeleted()) {
898
            throw new PropelException("You cannot save an object that has been deleted.");
899
        }
900
901
        if ($this->alreadyInSave) {
902
            return 0;
903
        }
904
905
        if ($con === null) {
906
            $con = Propel::getServiceContainer()->getWriteConnection(BannerImageTableMap::DATABASE_NAME);
907
        }
908
909
        return $con->transaction(function () use ($con) {
910
            $ret = $this->preSave($con);
911
            $isInsert = $this->isNew();
912
            if ($isInsert) {
913
                $ret = $ret && $this->preInsert($con);
914
            } else {
915
                $ret = $ret && $this->preUpdate($con);
916
            }
917
            if ($ret) {
918
                $affectedRows = $this->doSave($con);
919
                if ($isInsert) {
920
                    $this->postInsert($con);
921
                } else {
922
                    $this->postUpdate($con);
923
                }
924
                $this->postSave($con);
925
                BannerImageTableMap::addInstanceToPool($this);
926
            } else {
927
                $affectedRows = 0;
928
            }
929
930
            return $affectedRows;
931
        });
932
    }
933
934
    /**
935
     * Performs the work of inserting or updating the row in the database.

application/modules/xbanners/models/Base/BannerImageI18n.php 1 location

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

application/modules/xbanners/models/Base/Banners.php 1 location

@@ 737-774 (lines=38) @@
734
     * @throws PropelException
735
     * @see doSave()
736
     */
737
    public function save(ConnectionInterface $con = null)
738
    {
739
        if ($this->isDeleted()) {
740
            throw new PropelException("You cannot save an object that has been deleted.");
741
        }
742
743
        if ($this->alreadyInSave) {
744
            return 0;
745
        }
746
747
        if ($con === null) {
748
            $con = Propel::getServiceContainer()->getWriteConnection(BannersTableMap::DATABASE_NAME);
749
        }
750
751
        return $con->transaction(function () use ($con) {
752
            $ret = $this->preSave($con);
753
            $isInsert = $this->isNew();
754
            if ($isInsert) {
755
                $ret = $ret && $this->preInsert($con);
756
            } else {
757
                $ret = $ret && $this->preUpdate($con);
758
            }
759
            if ($ret) {
760
                $affectedRows = $this->doSave($con);
761
                if ($isInsert) {
762
                    $this->postInsert($con);
763
                } else {
764
                    $this->postUpdate($con);
765
                }
766
                $this->postSave($con);
767
                BannersTableMap::addInstanceToPool($this);
768
            } else {
769
                $affectedRows = 0;
770
            }
771
772
            return $affectedRows;
773
        });
774
    }
775
776
    /**
777
     * Performs the work of inserting or updating the row in the database.

application/modules/xbanners/models/Base/BannersI18n.php 1 location

@@ 600-637 (lines=38) @@
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 ($this->alreadyInSave) {
607
            return 0;
608
        }
609
610
        if ($con === null) {
611
            $con = Propel::getServiceContainer()->getWriteConnection(BannersI18nTableMap::DATABASE_NAME);
612
        }
613
614
        return $con->transaction(function () use ($con) {
615
            $ret = $this->preSave($con);
616
            $isInsert = $this->isNew();
617
            if ($isInsert) {
618
                $ret = $ret && $this->preInsert($con);
619
            } else {
620
                $ret = $ret && $this->preUpdate($con);
621
            }
622
            if ($ret) {
623
                $affectedRows = $this->doSave($con);
624
                if ($isInsert) {
625
                    $this->postInsert($con);
626
                } else {
627
                    $this->postUpdate($con);
628
                }
629
                $this->postSave($con);
630
                BannersI18nTableMap::addInstanceToPool($this);
631
            } else {
632
                $affectedRows = 0;
633
            }
634
635
            return $affectedRows;
636
        });
637
    }
638
639
    /**
640
     * Performs the work of inserting or updating the row in the database.