17 import(
'classes.publicationFormat.Market');
24 parent::__construct();
33 function getById($marketId, $publicationId =
null){
34 $sqlParams = array((
int) $marketId);
36 $sqlParams[] = (int) $publicationId;
42 JOIN publication_formats pf ON (m.publication_format_id = pf.publication_format_id)
44 ' . ($publicationId?
' AND pf.publication_id = ?':
''),
49 if ($result->RecordCount() != 0) {
50 $returner = $this->
_fromRow($result->GetRowAssoc(
false));
63 'SELECT * FROM markets WHERE publication_format_id = ?', (
int) $publicationFormatId);
84 $market->setId($row[
'market_id']);
85 $market->setCountriesIncluded(unserialize($row[
'countries_included']));
86 $market->setCountriesExcluded(unserialize($row[
'countries_excluded']));
87 $market->setRegionsIncluded(unserialize($row[
'regions_included']));
88 $market->setRegionsExcluded(unserialize($row[
'regions_excluded']));
89 $market->setDateRole($row[
'market_date_role']);
90 $market->setDateFormat($row[
'market_date_format']);
91 $market->setDate($row[
'market_date']);
92 $market->setDiscount($row[
'discount']);
93 $market->setPrice($row[
'price']);
94 $market->setPriceTypeCode($row[
'price_type_code']);
95 $market->setCurrencyCode($row[
'currency_code']);
96 $market->setTaxRateCode($row[
'tax_rate_code']);
97 $market->setTaxTypeCode($row[
'tax_type_code']);
98 $market->setAgentId($row[
'agent_id']);
99 $market->setSupplierId($row[
'supplier_id']);
100 $market->setPublicationFormatId($row[
'publication_format_id']);
114 (publication_format_id, countries_included, countries_excluded, regions_included, regions_excluded, market_date_role, market_date_format, market_date, price, discount, price_type_code, currency_code, tax_rate_code, tax_type_code, agent_id, supplier_id)
116 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
118 (
int) $market->getPublicationFormatId(),
119 serialize($market->getCountriesIncluded() ? $market->getCountriesIncluded() : array()),
120 serialize($market->getCountriesExcluded() ? $market->getCountriesExcluded() : array()),
121 serialize($market->getRegionsIncluded() ? $market->getRegionsIncluded() : array()),
122 serialize($market->getRegionsExcluded() ? $market->getRegionsExcluded() : array()),
123 $market->getDateRole(),
124 $market->getDateFormat(),
127 $market->getDiscount(),
128 $market->getPriceTypeCode(),
129 $market->getCurrencyCode(),
130 $market->getTaxRateCode(),
131 $market->getTaxTypeCode(),
132 (
int) $market->getAgentId(),
133 (
int) $market->getSupplierId()
138 return $market->getId();
148 SET countries_included = ?,
149 countries_excluded = ?,
150 regions_included = ?,
151 regions_excluded = ?,
152 market_date_role = ?,
153 market_date_format = ?,
163 WHERE market_id = ?',
165 serialize($market->getCountriesIncluded() ? $market->getCountriesIncluded() : array()),
166 serialize($market->getCountriesExcluded() ? $market->getCountriesExcluded() : array()),
167 serialize($market->getRegionsIncluded() ? $market->getRegionsIncluded() : array()),
168 serialize($market->getRegionsExcluded() ? $market->getRegionsExcluded() : array()),
169 $market->getDateRole(),
170 $market->getDateFormat(),
173 $market->getDiscount(),
174 $market->getPriceTypeCode(),
175 $market->getCurrencyCode(),
176 $market->getTaxRateCode(),
177 $market->getTaxTypeCode(),
178 (
int) $market->getAgentId(),
179 (
int) $market->getSupplierId(),
180 (
int) $market->getId()
199 'DELETE FROM markets WHERE market_id = ?', array((
int) $entryId)