1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 
<?php

/* --------------------------------------------------------------
   ProductAddonValueStorage.inc.php 2016-01-18
   Gambio GmbH
   http://www.gambio.de
   Copyright (c) 2016 Gambio GmbH
   Released under the GNU General Public License (Version 2)
   [http://www.gnu.org/licenses/gpl-2.0.html]
   --------------------------------------------------------------
*/

MainFactory::load_class('AbstractAddonValueStorage');

/**
 * Class ProductAddonValueStorage
 *
 * @category   System
 * @package    Product
 * @subpackage Storages
 */
class ProductAddonValueStorage extends AbstractAddonValueStorage
{
    /**
     * Get Container Type
     *
     * Returns the container class type.
     *
     * @return string
     */
    protected function _getContainerType()
    {
        return 'ProductInterface';
    }
    

    /**
     * Get External Fields Array
     *
     * Returns a multidimensional array with the primary key of the products_item_codes table
     * and the required column names with the corresponding key used in the KeyValueCollection.
     *
     * @return array
     */
    protected function _getExternalFieldsArray()
    {
        $externalFields = array();

        // Product item codes.
        $externalFields['products_item_codes']['primary_key'] = 'products_id';
        $externalFields['products_item_codes']['fields']      = array(
            'code_isbn'                     => 'codeIsbn',
            'code_upc'                      => 'codeUpc',
            'code_mpn'                      => 'codeMpn',
            'code_jan'                      => 'codeJan',
            'google_export_condition'       => 'googleExportCondition',
            'google_export_availability_id' => 'googleExportAvailabilityId',
            'brand_name'                    => 'brandName',
            'identifier_exists'             => 'identifierExists',
            'gender'                        => 'gender',
            'age_group'                     => 'ageGroup',
            'expiration_date'               => 'expirationDate',
        );

        // Product primary image dimensions.
        $externalFields['products']['primary_key'] = 'products_id';
        $externalFields['products']['fields']      = array(
            'products_image_w' => 'productsImageWidth',
            'products_image_h' => 'productsImageHeight',
        );

        return $externalFields;
    }
}