Code Duplication    Length = 34-34 lines in 4 locations

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

@@ 895-928 (lines=34) @@
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 ($con === null) {
902
            $con = Propel::getServiceContainer()->getWriteConnection(BannerImageTableMap::DATABASE_NAME);
903
        }
904
905
        return $con->transaction(function () use ($con) {
906
            $ret = $this->preSave($con);
907
            $isInsert = $this->isNew();
908
            if ($isInsert) {
909
                $ret = $ret && $this->preInsert($con);
910
            } else {
911
                $ret = $ret && $this->preUpdate($con);
912
            }
913
            if ($ret) {
914
                $affectedRows = $this->doSave($con);
915
                if ($isInsert) {
916
                    $this->postInsert($con);
917
                } else {
918
                    $this->postUpdate($con);
919
                }
920
                $this->postSave($con);
921
                BannerImageTableMap::addInstanceToPool($this);
922
            } else {
923
                $affectedRows = 0;
924
            }
925
926
            return $affectedRows;
927
        });
928
    }
929
930
    /**
931
     * Performs the work of inserting or updating the row in the database.

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

@@ 720-753 (lines=34) @@
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 ($con === null) {
727
            $con = Propel::getServiceContainer()->getWriteConnection(BannerImageI18nTableMap::DATABASE_NAME);
728
        }
729
730
        return $con->transaction(function () use ($con) {
731
            $ret = $this->preSave($con);
732
            $isInsert = $this->isNew();
733
            if ($isInsert) {
734
                $ret = $ret && $this->preInsert($con);
735
            } else {
736
                $ret = $ret && $this->preUpdate($con);
737
            }
738
            if ($ret) {
739
                $affectedRows = $this->doSave($con);
740
                if ($isInsert) {
741
                    $this->postInsert($con);
742
                } else {
743
                    $this->postUpdate($con);
744
                }
745
                $this->postSave($con);
746
                BannerImageI18nTableMap::addInstanceToPool($this);
747
            } else {
748
                $affectedRows = 0;
749
            }
750
751
            return $affectedRows;
752
        });
753
    }
754
755
    /**
756
     * Performs the work of inserting or updating the row in the database.

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

@@ 737-770 (lines=34) @@
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 ($con === null) {
744
            $con = Propel::getServiceContainer()->getWriteConnection(BannersTableMap::DATABASE_NAME);
745
        }
746
747
        return $con->transaction(function () use ($con) {
748
            $ret = $this->preSave($con);
749
            $isInsert = $this->isNew();
750
            if ($isInsert) {
751
                $ret = $ret && $this->preInsert($con);
752
            } else {
753
                $ret = $ret && $this->preUpdate($con);
754
            }
755
            if ($ret) {
756
                $affectedRows = $this->doSave($con);
757
                if ($isInsert) {
758
                    $this->postInsert($con);
759
                } else {
760
                    $this->postUpdate($con);
761
                }
762
                $this->postSave($con);
763
                BannersTableMap::addInstanceToPool($this);
764
            } else {
765
                $affectedRows = 0;
766
            }
767
768
            return $affectedRows;
769
        });
770
    }
771
772
    /**
773
     * Performs the work of inserting or updating the row in the database.

application/modules/xbanners/models/Base/BannersI18n.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(BannersI18nTableMap::DATABASE_NAME);
608
        }
609
610
        return $con->transaction(function () use ($con) {
611
            $ret = $this->preSave($con);
612
            $isInsert = $this->isNew();
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
                BannersI18nTableMap::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.