Code Duplication    Length = 55-56 lines in 2 locations

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

@@ 969-1023 (lines=55) @@
966
     *
967
     * @return array an associative array containing the field names (as keys) and field values
968
     */
969
    public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
970
    {
971
972
        if (isset($alreadyDumpedObjects['Route'][$this->hashCode()])) {
973
            return '*RECURSION*';
974
        }
975
        $alreadyDumpedObjects['Route'][$this->hashCode()] = true;
976
        $keys = RouteTableMap::getFieldNames($keyType);
977
        $result = array(
978
            $keys[0] => $this->getId(),
979
            $keys[1] => $this->getEntityId(),
980
            $keys[2] => $this->getType(),
981
            $keys[3] => $this->getParentUrl(),
982
            $keys[4] => $this->getUrl(),
983
        );
984
        $virtualColumns = $this->virtualColumns;
985
        foreach ($virtualColumns as $key => $virtualColumn) {
986
            $result[$key] = $virtualColumn;
987
        }
988
989
        if ($includeForeignObjects) {
990
            if (null !== $this->collSCategories) {
991
992
                switch ($keyType) {
993
                    case TableMap::TYPE_CAMELNAME:
994
                        $key = 'sCategories';
995
                        break;
996
                    case TableMap::TYPE_FIELDNAME:
997
                        $key = 'shop_categories';
998
                        break;
999
                    default:
1000
                        $key = 'SCategories';
1001
                }
1002
1003
                $result[$key] = $this->collSCategories->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1004
            }
1005
            if (null !== $this->collSProductss) {
1006
1007
                switch ($keyType) {
1008
                    case TableMap::TYPE_CAMELNAME:
1009
                        $key = 'sProductss';
1010
                        break;
1011
                    case TableMap::TYPE_FIELDNAME:
1012
                        $key = 'shop_productss';
1013
                        break;
1014
                    default:
1015
                        $key = 'SProductss';
1016
                }
1017
1018
                $result[$key] = $this->collSProductss->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1019
            }
1020
        }
1021
1022
        return $result;
1023
    }
1024
1025
    /**
1026
     * Sets a field from the object by name passed in as a string.

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

@@ 1012-1067 (lines=56) @@
1009
     *
1010
     * @return array an associative array containing the field names (as keys) and field values
1011
     */
1012
    public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
1013
    {
1014
1015
        if (isset($alreadyDumpedObjects['Banners'][$this->hashCode()])) {
1016
            return '*RECURSION*';
1017
        }
1018
        $alreadyDumpedObjects['Banners'][$this->hashCode()] = true;
1019
        $keys = BannersTableMap::getFieldNames($keyType);
1020
        $result = array(
1021
            $keys[0] => $this->getId(),
1022
            $keys[1] => $this->getPlace(),
1023
            $keys[2] => $this->getWidth(),
1024
            $keys[3] => $this->getHeight(),
1025
            $keys[4] => $this->getEffects(),
1026
            $keys[5] => $this->getPageType(),
1027
        );
1028
        $virtualColumns = $this->virtualColumns;
1029
        foreach ($virtualColumns as $key => $virtualColumn) {
1030
            $result[$key] = $virtualColumn;
1031
        }
1032
1033
        if ($includeForeignObjects) {
1034
            if (null !== $this->collBannerImages) {
1035
1036
                switch ($keyType) {
1037
                    case TableMap::TYPE_CAMELNAME:
1038
                        $key = 'bannerImages';
1039
                        break;
1040
                    case TableMap::TYPE_FIELDNAME:
1041
                        $key = 'banner_images';
1042
                        break;
1043
                    default:
1044
                        $key = 'BannerImages';
1045
                }
1046
1047
                $result[$key] = $this->collBannerImages->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1048
            }
1049
            if (null !== $this->collBannersI18ns) {
1050
1051
                switch ($keyType) {
1052
                    case TableMap::TYPE_CAMELNAME:
1053
                        $key = 'bannersI18ns';
1054
                        break;
1055
                    case TableMap::TYPE_FIELDNAME:
1056
                        $key = 'banners_i18ns';
1057
                        break;
1058
                    default:
1059
                        $key = 'BannersI18ns';
1060
                }
1061
1062
                $result[$key] = $this->collBannersI18ns->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
1063
            }
1064
        }
1065
1066
        return $result;
1067
    }
1068
1069
    /**
1070
     * Sets a field from the object by name passed in as a string.