Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f09f3e3
commit aeb64cf
Showing
24 changed files
with
193 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,2 @@ | ||
<?php | ||
return array( | ||
|
||
'Catalog\Controller\CatalogController' => __DIR__ . '/src/Catalog/Controller/CatalogController.php', | ||
'CatalogManager\Controller\CatalogManagerController' | ||
=> __DIR__ . '/src/CatalogManager/Controller/CatalogManagerController.php', | ||
'Catalog\Controller\ErrorController' => __DIR__ . '/src/Catalog/Controller/ErrorController.php', | ||
'Catalog\Module' => __DIR__ . '/Module.php', | ||
|
||
/** | ||
* Services | ||
*/ | ||
'Catalog\Service\ServiceInterface' => __DIR__ . '/src/Catalog/Service/ServiceInterface.php', | ||
'Catalog\Service\ServiceAbstract' => __DIR__ . '/src/Catalog/Service/ServiceAbstract.php', | ||
'Catalog\Service\ProductService' => __DIR__ . '/src/Catalog/Service/ProductService.php', | ||
'Catalog\Service\OptionService' => __DIR__ . '/src/Catalog/Service/OptionService.php', | ||
'Catalog\Service\ChoiceService' => __DIR__ . '/src/Catalog/Service/ChoiceService.php', | ||
'Catalog\Service\ProductUomService' => __DIR__ . '/src/Catalog/Service/ProductUomService.php', | ||
'Catalog\Service\UomService' => __DIR__ . '/src/Catalog/Service/UomService.php', | ||
'Catalog\Service\AvailabilityService' => __DIR__ . '/src/Catalog/Service/AvailabilityService.php', | ||
'Catalog\Service\CompanyService' => __DIR__ . '/src/Catalog/Service/CompanyService.php', | ||
'Catalog\Service\CategoryService' => __DIR__ . '/src/Catalog/Service/CategoryService.php', | ||
'Catalog\Service\SpecService' => __DIR__ . '/src/Catalog/Service/SpecService.php', | ||
'Catalog\Service\MediaServiceInterface' => __DIR__ . '/src/Catalog/Service/MediaServiceInterface.php', | ||
'Catalog\Service\MediaServiceAbstract' => __DIR__ . '/src/Catalog/Service/MediaServiceAbstract.php', | ||
'Catalog\Service\DocumentService' => __DIR__ . '/src/Catalog/Service/DocumentService.php', | ||
'Catalog\Service\ImageService' => __DIR__ . '/src/Catalog/Service/ImageService.php', | ||
'Catalog\Service\CatalogService' => __DIR__ . '/src/Catalog/Service/CatalogService.php', | ||
'Catalog\Service\Installer' => __DIR__ . '/src/Catalog/Service/Installer.php', | ||
|
||
'CatalogManager\Service\ModelLinkerService' => __DIR__ . '/src/CatalogManager/Service/ModelLinkerService.php', | ||
|
||
/** | ||
* Mappers | ||
*/ | ||
'Catalog\Model\Mapper\ModelMapperInterface' => __DIR__ . '/src/Catalog/Model/Mapper/ModelMapperInterface.php', | ||
'Catalog\Model\Mapper\DbMapperAbstract' => __DIR__ . '/src/Catalog/Model/Mapper/DbMapperAbstract.php', | ||
'Catalog\Model\Mapper\ProductMapper' => __DIR__ . '/src/Catalog/Model/Mapper/ProductMapper.php', | ||
'Catalog\Model\Mapper\OptionMapper' => __DIR__ . '/src/Catalog/Model/Mapper/OptionMapper.php', | ||
'Catalog\Model\Mapper\ChoiceMapper' => __DIR__ . '/src/Catalog/Model/Mapper/ChoiceMapper.php', | ||
'Catalog\Model\Mapper\ProductUomMapper' => __DIR__ . '/src/Catalog/Model/Mapper/ProductUomMapper.php', | ||
'Catalog\Model\Mapper\UomMapper' => __DIR__ . '/src/Catalog/Model/Mapper/UomMapper.php', | ||
'Catalog\Model\Mapper\AvailabilityMapper' => __DIR__ . '/src/Catalog/Model/Mapper/AvailabilityMapper.php', | ||
'Catalog\Model\Mapper\CompanyMapper' => __DIR__ . '/src/Catalog/Model/Mapper/CompanyMapper.php', | ||
'Catalog\Model\Mapper\CategoryMapper' => __DIR__ . '/src/Catalog/Model/Mapper/CategoryMapper.php', | ||
'Catalog\Model\Mapper\SpecMapper' => __DIR__ . '/src/Catalog/Model/Mapper/SpecMapper.php', | ||
'Catalog\Model\Mapper\MediaMapperAbstract' => __DIR__ . '/src/Catalog/Model/Mapper/MediaMapperAbstract.php', | ||
'Catalog\Model\Mapper\DocumentMapper' => __DIR__ . '/src/Catalog/Model/Mapper/DocumentMapper.php', | ||
'Catalog\Model\Mapper\MYSQL_CatalogMapper' => __DIR__ . '/src/Catalog/Model/Mapper/MYSQL_CatalogMapper.php', | ||
|
||
/** | ||
* Models | ||
*/ | ||
'Catalog\Model\ModelInterface' => __DIR__ . '/src/Catalog/Model/ModelInterface.php', | ||
'Catalog\Model\ModelAbstract' => __DIR__ . '/src/Catalog/Model/ModelAbstract.php', | ||
'Catalog\Model\Product' => __DIR__ . '/src/Catalog/Model/Product.php', | ||
'Catalog\Model\Option' => __DIR__ . '/src/Catalog/Model/Option.php', | ||
'Catalog\Model\OptionSlider' => __DIR__ . '/src/Catalog/Model/OptionSlider.php', | ||
'Catalog\Model\Choice' => __DIR__ . '/src/Catalog/Model/Choice.php', | ||
'Catalog\Model\Category' => __DIR__ . '/src/Catalog/Model/Category.php', | ||
'Catalog\Model\ProductUom' => __DIR__ . '/src/Catalog/Model/ProductUom.php', | ||
'Catalog\Model\Uom' => __DIR__ . '/src/Catalog/Model/Uom.php', | ||
'Catalog\Model\Availability' => __DIR__ . '/src/Catalog/Model/Availability.php', | ||
'Catalog\Model\Company' => __DIR__ . '/src/Catalog/Model/Company.php', | ||
'Catalog\Model\Spec' => __DIR__ . '/src/Catalog/Model/Spec.php', | ||
'Catalog\Model\MediaAbstract' => __DIR__ . '/src/Catalog/Model/MediaAbstract.php', | ||
'Catalog\Model\Document' => __DIR__ . '/src/Catalog/Model/Document.php', | ||
'Catalog\Model\Image' => __DIR__ . '/src/Catalog/Model/Image.php', | ||
|
||
); | ||
return array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
namespace Catalog\Model\Mapper; | ||
use Catalog\Model\Image, | ||
ArrayObject; | ||
class ImageMapper extends MediaMapperAbstract | ||
{ | ||
protected $linkerTableName = 'catalog_product_image_linker'; | ||
|
||
public function getModel() | ||
{ | ||
return new Image; | ||
} | ||
|
||
public function getModelClass() | ||
{ | ||
return 'media'; | ||
} | ||
|
||
public function getImagesByProductId($productId) | ||
{ | ||
$db = $this->getReadAdapter(); | ||
$sql = $db->select() | ||
->from($this->getLinkerTableName()) | ||
->join( | ||
$this->getTableName(), | ||
$this->getLinkerTableName().'.media_id = '.$this->getTableName().'.media_id' | ||
) | ||
->where('product_id = ?', $productId); | ||
$this->events()->trigger(__FUNCTION__, $this, array('query' => $sql)); | ||
$rows = $db->fetchAll($sql); | ||
|
||
$specs = array(); | ||
if (count($rows) > 0){ | ||
foreach($rows as $row){ | ||
$specs[] = $this->mapModel($row); | ||
} | ||
} | ||
return $specs; | ||
} | ||
|
||
public function linkParentProduct($productId, $imageId) | ||
{ | ||
$db = $this->getReadAdapter(); | ||
$sql = $db->select() | ||
->from($this->getLinkerTableName()) | ||
->where('product_id = ?', $productId) | ||
->where('media_id = ?', $imageId); | ||
$this->events()->trigger(__FUNCTION__, $this, array('query' => $sql)); | ||
$row = $db->fetchRow($sql); | ||
if(false === $row){ | ||
$data = new ArrayObject(array( | ||
'product_id' => $productId, | ||
'media_id' => $imageId, | ||
)); | ||
$db->insert($this->getLinkerTableName(), (array) $data); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.