Code Duplication    Length = 37-38 lines in 3 locations

application/modules/mod_link/models/Base/PageLinkProduct.php 1 location

@@ 744-780 (lines=37) @@
741
     *
742
     * @return array an associative array containing the field names (as keys) and field values
743
     */
744
    public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
745
    {
746
747
        if (isset($alreadyDumpedObjects['PageLinkProduct'][$this->hashCode()])) {
748
            return '*RECURSION*';
749
        }
750
        $alreadyDumpedObjects['PageLinkProduct'][$this->hashCode()] = true;
751
        $keys = PageLinkProductTableMap::getFieldNames($keyType);
752
        $result = array(
753
            $keys[0] => $this->getLinkId(),
754
            $keys[1] => $this->getProductId(),
755
        );
756
        $virtualColumns = $this->virtualColumns;
757
        foreach ($virtualColumns as $key => $virtualColumn) {
758
            $result[$key] = $virtualColumn;
759
        }
760
761
        if ($includeForeignObjects) {
762
            if (null !== $this->aPageLink) {
763
764
                switch ($keyType) {
765
                    case TableMap::TYPE_CAMELNAME:
766
                        $key = 'pageLink';
767
                        break;
768
                    case TableMap::TYPE_FIELDNAME:
769
                        $key = 'page_link';
770
                        break;
771
                    default:
772
                        $key = 'PageLink';
773
                }
774
775
                $result[$key] = $this->aPageLink->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
776
            }
777
        }
778
779
        return $result;
780
    }
781
782
    /**
783
     * Sets a field from the object by name passed in as a string.

application/modules/mod_link/models/Base/PageLinkProducts.php 1 location

@@ 744-780 (lines=37) @@
741
     *
742
     * @return array an associative array containing the field names (as keys) and field values
743
     */
744
    public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
745
    {
746
747
        if (isset($alreadyDumpedObjects['PageLinkProducts'][$this->hashCode()])) {
748
            return '*RECURSION*';
749
        }
750
        $alreadyDumpedObjects['PageLinkProducts'][$this->hashCode()] = true;
751
        $keys = PageLinkProductsTableMap::getFieldNames($keyType);
752
        $result = array(
753
            $keys[0] => $this->getLinkId(),
754
            $keys[1] => $this->getProductId(),
755
        );
756
        $virtualColumns = $this->virtualColumns;
757
        foreach ($virtualColumns as $key => $virtualColumn) {
758
            $result[$key] = $virtualColumn;
759
        }
760
761
        if ($includeForeignObjects) {
762
            if (null !== $this->aPageLink) {
763
764
                switch ($keyType) {
765
                    case TableMap::TYPE_CAMELNAME:
766
                        $key = 'pageLink';
767
                        break;
768
                    case TableMap::TYPE_FIELDNAME:
769
                        $key = 'page_link';
770
                        break;
771
                    default:
772
                        $key = 'PageLink';
773
                }
774
775
                $result[$key] = $this->aPageLink->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
776
            }
777
        }
778
779
        return $result;
780
    }
781
782
    /**
783
     * Sets a field from the object by name passed in as a string.

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

@@ 811-848 (lines=38) @@
808
     *
809
     * @return array an associative array containing the field names (as keys) and field values
810
     */
811
    public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
812
    {
813
814
        if (isset($alreadyDumpedObjects['BannersI18n'][$this->hashCode()])) {
815
            return '*RECURSION*';
816
        }
817
        $alreadyDumpedObjects['BannersI18n'][$this->hashCode()] = true;
818
        $keys = BannersI18nTableMap::getFieldNames($keyType);
819
        $result = array(
820
            $keys[0] => $this->getId(),
821
            $keys[1] => $this->getLocale(),
822
            $keys[2] => $this->getName(),
823
        );
824
        $virtualColumns = $this->virtualColumns;
825
        foreach ($virtualColumns as $key => $virtualColumn) {
826
            $result[$key] = $virtualColumn;
827
        }
828
829
        if ($includeForeignObjects) {
830
            if (null !== $this->aBanners) {
831
832
                switch ($keyType) {
833
                    case TableMap::TYPE_CAMELNAME:
834
                        $key = 'banners';
835
                        break;
836
                    case TableMap::TYPE_FIELDNAME:
837
                        $key = 'banners';
838
                        break;
839
                    default:
840
                        $key = 'Banners';
841
                }
842
843
                $result[$key] = $this->aBanners->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
844
            }
845
        }
846
847
        return $result;
848
    }
849
850
    /**
851
     * Sets a field from the object by name passed in as a string.