Code Duplication    Length = 55-56 lines in 2 locations

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

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

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

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