Code Duplication    Length = 57-57 lines in 2 locations

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

@@ 753-809 (lines=57) @@
750
     * @throws PropelException
751
     * @see save()
752
     */
753
    protected function doSave(ConnectionInterface $con)
754
    {
755
        $affectedRows = 0; // initialize var to track total num of affected rows
756
        if (!$this->alreadyInSave) {
757
            $this->alreadyInSave = true;
758
759
            if ($this->isNew() || $this->isModified()) {
760
                // persist changes
761
                if ($this->isNew()) {
762
                    $this->doInsert($con);
763
                    $affectedRows += 1;
764
                } else {
765
                    $affectedRows += $this->doUpdate($con);
766
                }
767
                $this->resetModified();
768
            }
769
770
            if ($this->sCategoriesScheduledForDeletion !== null) {
771
                if (!$this->sCategoriesScheduledForDeletion->isEmpty()) {
772
                    \SCategoryQuery::create()
773
                        ->filterByPrimaryKeys($this->sCategoriesScheduledForDeletion->getPrimaryKeys(false))
774
                        ->delete($con);
775
                    $this->sCategoriesScheduledForDeletion = null;
776
                }
777
            }
778
779
            if ($this->collSCategories !== null) {
780
                foreach ($this->collSCategories as $referrerFK) {
781
                    if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
782
                        $affectedRows += $referrerFK->save($con);
783
                    }
784
                }
785
            }
786
787
            if ($this->sProductssScheduledForDeletion !== null) {
788
                if (!$this->sProductssScheduledForDeletion->isEmpty()) {
789
                    \SProductsQuery::create()
790
                        ->filterByPrimaryKeys($this->sProductssScheduledForDeletion->getPrimaryKeys(false))
791
                        ->delete($con);
792
                    $this->sProductssScheduledForDeletion = null;
793
                }
794
            }
795
796
            if ($this->collSProductss !== null) {
797
                foreach ($this->collSProductss as $referrerFK) {
798
                    if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
799
                        $affectedRows += $referrerFK->save($con);
800
                    }
801
                }
802
            }
803
804
            $this->alreadyInSave = false;
805
806
        }
807
808
        return $affectedRows;
809
    } // doSave()
810
811
    /**
812
     * Insert the row in the database.

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

@@ 787-843 (lines=57) @@
784
     * @throws PropelException
785
     * @see save()
786
     */
787
    protected function doSave(ConnectionInterface $con)
788
    {
789
        $affectedRows = 0; // initialize var to track total num of affected rows
790
        if (!$this->alreadyInSave) {
791
            $this->alreadyInSave = true;
792
793
            if ($this->isNew() || $this->isModified()) {
794
                // persist changes
795
                if ($this->isNew()) {
796
                    $this->doInsert($con);
797
                    $affectedRows += 1;
798
                } else {
799
                    $affectedRows += $this->doUpdate($con);
800
                }
801
                $this->resetModified();
802
            }
803
804
            if ($this->bannerImagesScheduledForDeletion !== null) {
805
                if (!$this->bannerImagesScheduledForDeletion->isEmpty()) {
806
                    \xbanners\models\BannerImageQuery::create()
807
                        ->filterByPrimaryKeys($this->bannerImagesScheduledForDeletion->getPrimaryKeys(false))
808
                        ->delete($con);
809
                    $this->bannerImagesScheduledForDeletion = null;
810
                }
811
            }
812
813
            if ($this->collBannerImages !== null) {
814
                foreach ($this->collBannerImages as $referrerFK) {
815
                    if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
816
                        $affectedRows += $referrerFK->save($con);
817
                    }
818
                }
819
            }
820
821
            if ($this->bannersI18nsScheduledForDeletion !== null) {
822
                if (!$this->bannersI18nsScheduledForDeletion->isEmpty()) {
823
                    \xbanners\models\BannersI18nQuery::create()
824
                        ->filterByPrimaryKeys($this->bannersI18nsScheduledForDeletion->getPrimaryKeys(false))
825
                        ->delete($con);
826
                    $this->bannersI18nsScheduledForDeletion = null;
827
                }
828
            }
829
830
            if ($this->collBannersI18ns !== null) {
831
                foreach ($this->collBannersI18ns as $referrerFK) {
832
                    if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
833
                        $affectedRows += $referrerFK->save($con);
834
                    }
835
                }
836
            }
837
838
            $this->alreadyInSave = false;
839
840
        }
841
842
        return $affectedRows;
843
    } // doSave()
844
845
    /**
846
     * Insert the row in the database.