Code Duplication    Length = 57-57 lines in 2 locations

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

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

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

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