Code Duplication    Length = 34-34 lines in 4 locations

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

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

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

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

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

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

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

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