Refactoring of images and documents management

This commit is contained in:
Franck Allimant
2014-06-26 10:36:12 +02:00
parent b49f8a6423
commit 114a55c1e8
33 changed files with 1795 additions and 2216 deletions

View File

@@ -2,16 +2,23 @@
namespace Thelia\Model;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Router;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Files\FileModelParentInterface;
use Thelia\Form\BaseForm;
use Thelia\Form\CategoryImageModification;
use Thelia\Model\Base\CategoryImage as BaseCategoryImage;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Base\CategoryImageQuery;
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
use Thelia\Model\Breadcrumb\CatalogBreadcrumbTrait;
use Thelia\Files\FileModelInterface;
use Thelia\Model\Tools\ModelEventDispatcherTrait;
use Thelia\Model\Tools\PositionManagementTrait;
class CategoryImage extends BaseCategoryImage implements BreadcrumbInterface
class CategoryImage extends BaseCategoryImage implements BreadcrumbInterface, FileModelInterface
{
use ModelEventDispatcherTrait;
use PositionManagementTrait;
@@ -19,6 +26,8 @@ class CategoryImage extends BaseCategoryImage implements BreadcrumbInterface
/**
* Calculate next position relative to our parent
*
* @param CategoryImageQuery $query
*/
protected function addCriteriaToPositionQuery($query)
{
@@ -36,11 +45,7 @@ class CategoryImage extends BaseCategoryImage implements BreadcrumbInterface
}
/**
* Set Image parent id
*
* @param int $parentId parent id
*
* @return $this
* @inheritdoc
*/
public function setParentId($parentId)
{
@@ -50,9 +55,7 @@ class CategoryImage extends BaseCategoryImage implements BreadcrumbInterface
}
/**
* Get Image parent id
*
* @return int parent id
* @inheritdoc
*/
public function getParentId()
{
@@ -71,13 +74,68 @@ class CategoryImage extends BaseCategoryImage implements BreadcrumbInterface
}
/**
*
* return the complete breadcrumb for a given resource.
*
* @return array
* @inheritdoc
*/
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab)
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale)
{
return $this->getCategoryBreadcrumb($router, $container, $tab);
return $this->getCategoryBreadcrumb($router, $container, $tab, $locale);
}
/**
* @return FileModelParentInterface the parent file model
*/
public function getParentFileModel()
{
return new Category();
}
/**
* Get the ID of the form used to change this object information
*
* @return BaseForm the form
*/
public function getUpdateFormId()
{
return 'thelia.admin.category.image.modification';
}
/**
* Get the form instance used to change this object information
*
* @param \Thelia\Core\HttpFoundation\Request $request
*
* @return BaseForm the form
*/
public function getUpdateFormInstance(Request $request)
{
return new CategoryImageModification($request);
}
/**
* @return string the path to the upload directory where files are stored, without final slash
*/
public function getUploadDir()
{
return THELIA_LOCAL_DIR . 'media'.DS.'images'.DS.'category';
}
/**
* @param int $objectId the ID of the object
*
* @return string the URL to redirect to after update from the back-office
*/
public function getRedirectionUrl($objectId)
{
return '/admin/categories/update?category_id=' . $objectId . '?current_tab=image';
}
/**
* Get the Query instance for this object
*
* @return ModelCriteria
*/
public function getQueryInstance()
{
return CategoryImageQuery::create();
}
}

View File

@@ -6,19 +6,23 @@ use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Propel;
use Thelia\Core\Event\Content\ContentEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Files\FileModelParentInterface;
use Thelia\Model\Base\Content as BaseContent;
use Thelia\Model\Map\ContentTableMap;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Tools\ModelEventDispatcherTrait;
use Thelia\Model\Tools\PositionManagementTrait;
use Thelia\Model\Tools\UrlRewritingTrait;
class Content extends BaseContent
class Content extends BaseContent implements FileModelParentInterface
{
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait;
use PositionManagementTrait;
use \Thelia\Model\Tools\UrlRewritingTrait;
use UrlRewritingTrait;
/**
* {@inheritDoc}

View File

@@ -2,14 +2,21 @@
namespace Thelia\Model;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Router;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Files\FileModelParentInterface;
use Thelia\Form\BaseForm;
use Thelia\Form\ContentDocumentModification;
use Thelia\Model\Base\ContentDocument as BaseContentDocument;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Base\ContentDocumentQuery;
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
use Thelia\Model\Breadcrumb\FolderBreadcrumbTrait;
use Thelia\Files\FileModelInterface;
class ContentDocument extends BaseContentDocument implements BreadcrumbInterface
class ContentDocument extends BaseContentDocument implements BreadcrumbInterface, FileModelInterface
{
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait;
@@ -17,6 +24,8 @@ class ContentDocument extends BaseContentDocument implements BreadcrumbInterface
/**
* Calculate next position relative to our parent
*
* @param ContentDocumentQuery $query
*/
protected function addCriteriaToPositionQuery($query)
{
@@ -34,11 +43,7 @@ class ContentDocument extends BaseContentDocument implements BreadcrumbInterface
}
/**
* Set Document parent id
*
* @param int $parentId parent id
*
* @return $this
* @inheritdoc
*/
public function setParentId($parentId)
{
@@ -48,9 +53,7 @@ class ContentDocument extends BaseContentDocument implements BreadcrumbInterface
}
/**
* Get Document parent id
*
* @return int parent id
* @inheritdoc
*/
public function getParentId()
{
@@ -69,13 +72,68 @@ class ContentDocument extends BaseContentDocument implements BreadcrumbInterface
}
/**
*
* return the complete breadcrumb for a given resource.
*
* @return array
* @inheritdoc
*/
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab)
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale)
{
return $this->getContentBreadcrumb($router, $container, $tab);
return $this->getContentBreadcrumb($router, $container, $tab, $locale);
}
/**
* @return FileModelParentInterface the parent file model
*/
public function getParentFileModel()
{
return new Content();
}
/**
* Get the ID of the form used to change this object information
*
* @return BaseForm the form
*/
public function getUpdateFormId()
{
return 'thelia.admin.content.document.modification';
}
/**
* Get the form instance used to change this object information
*
* @param \Thelia\Core\HttpFoundation\Request $request
*
* @return BaseForm the form
*/
public function getUpdateFormInstance(Request $request)
{
return new ContentDocumentModification($request);
}
/**
* @return string the path to the upload directory where files are stored, without final slash
*/
public function getUploadDir()
{
return THELIA_LOCAL_DIR . 'media'.DS.'documents'.DS.'content';
}
/**
* @param int $objectId the ID of the object
*
* @return string the URL to redirect to after update from the back-office
*/
public function getRedirectionUrl($objectId)
{
return '/admin/content/update/' . $objectId . '?current_tab=document';
}
/**
* Get the Query instance for this object
*
* @return ModelCriteria
*/
public function getQueryInstance()
{
return ContentDocumentQuery::create();
}
}

View File

@@ -2,14 +2,20 @@
namespace Thelia\Model;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Router;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Files\FileModelParentInterface;
use Thelia\Form\BaseForm;
use Thelia\Form\ContentImageModification;
use Thelia\Model\Base\ContentImage as BaseContentImage;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
use Thelia\Model\Breadcrumb\FolderBreadcrumbTrait;
use Thelia\Files\FileModelInterface;
class ContentImage extends BaseContentImage implements BreadcrumbInterface
class ContentImage extends BaseContentImage implements BreadcrumbInterface, FileModelInterface
{
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait;
@@ -17,6 +23,8 @@ class ContentImage extends BaseContentImage implements BreadcrumbInterface
/**
* Calculate next position relative to our parent
*
* @param ContentImageQuery $query
*/
protected function addCriteriaToPositionQuery($query)
{
@@ -34,11 +42,7 @@ class ContentImage extends BaseContentImage implements BreadcrumbInterface
}
/**
* Set Image parent id
*
* @param int $parentId parent id
*
* @return $this
* @inheritdoc
*/
public function setParentId($parentId)
{
@@ -48,9 +52,7 @@ class ContentImage extends BaseContentImage implements BreadcrumbInterface
}
/**
* Get Image parent id
*
* @return int parent id
* @inheritdoc
*/
public function getParentId()
{
@@ -69,13 +71,69 @@ class ContentImage extends BaseContentImage implements BreadcrumbInterface
}
/**
*
* return the complete breadcrumb for a given resource.
*
* @return array
* @inheritdoc
*/
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab)
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale)
{
return $this->getContentBreadcrumb($router, $container, $tab);
return $this->getContentBreadcrumb($router, $container, $tab, $locale);
}
/**
* @return FileModelParentInterface the parent file model
*/
public function getParentFileModel()
{
return new Content();
}
/**
* Get the ID of the form used to change this object information
*
* @return BaseForm the form
*/
public function getUpdateFormId()
{
return 'thelia.admin.content.image.modification';
}
/**
* Get the form instance used to change this object information
*
* @param \Thelia\Core\HttpFoundation\Request $request
*
* @return BaseForm the form
*/
public function getUpdateFormInstance(Request $request)
{
return new ContentImageModification($request);
}
/**
* @return string the path to the upload directory where files are stored, without final slash
*/
public function getUploadDir()
{
return THELIA_LOCAL_DIR . 'media'.DS.'images'.DS.'content';
}
/**
* @param int $objectId the ID of the object
*
* @return string the URL to redirect to after update from the back-office
*/
public function getRedirectionUrl($objectId)
{
return '/admin/content/update/' . $objectId . '?current_tab=image';
}
/**
* Get the Query instance for this object
*
* @return ModelCriteria
*/
public function getQueryInstance()
{
return ContentImageQuery::create();
}
}

View File

@@ -4,11 +4,12 @@ namespace Thelia\Model;
use Thelia\Core\Event\Folder\FolderEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Files\FileModelParentInterface;
use Thelia\Model\Base\Folder as BaseFolder;
use Propel\Runtime\Connection\ConnectionInterface;
class Folder extends BaseFolder
class Folder extends BaseFolder implements FileModelParentInterface
{
use \Thelia\Model\Tools\ModelEventDispatcherTrait;

View File

@@ -2,14 +2,20 @@
namespace Thelia\Model;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Router;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Files\FileModelParentInterface;
use Thelia\Form\BaseForm;
use Thelia\Form\FolderDocumentModification;
use Thelia\Model\Base\FolderDocument as BaseFolderDocument;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
use Thelia\Model\Breadcrumb\FolderBreadcrumbTrait;
use Thelia\Files\FileModelInterface;
class FolderDocument extends BaseFolderDocument implements BreadcrumbInterface
class FolderDocument extends BaseFolderDocument implements BreadcrumbInterface, FileModelInterface
{
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait;
@@ -17,6 +23,8 @@ class FolderDocument extends BaseFolderDocument implements BreadcrumbInterface
/**
* Calculate next position relative to our parent
*
* @param FolderDocumentQuery $query
*/
protected function addCriteriaToPositionQuery($query)
{
@@ -34,11 +42,7 @@ class FolderDocument extends BaseFolderDocument implements BreadcrumbInterface
}
/**
* Set Document parent id
*
* @param int $parentId parent id
*
* @return $this
* @inheritdoc
*/
public function setParentId($parentId)
{
@@ -48,9 +52,7 @@ class FolderDocument extends BaseFolderDocument implements BreadcrumbInterface
}
/**
* Get Document parent id
*
* @return int parent id
* @inheritdoc
*/
public function getParentId()
{
@@ -68,8 +70,68 @@ class FolderDocument extends BaseFolderDocument implements BreadcrumbInterface
return true;
}
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab)
/**
* @inheritdoc
*/
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale)
{
return $this->getFolderBreadcrumb($router, $container, $tab);
return $this->getFolderBreadcrumb($router, $container, $tab, $locale);
}
/**
* @return FileModelParentInterface the parent file model
*/
public function getParentFileModel()
{
return new Folder();
}
/**
* Get the ID of the form used to change this object information
*
* @return BaseForm the form
*/
public function getUpdateFormId()
{
return 'thelia.admin.folder.document.modification';
}
/**
* Get the form instance used to change this object information
*
* @param \Thelia\Core\HttpFoundation\Request $request
*
* @return BaseForm the form
*/
public function getUpdateFormInstance(Request $request)
{
return new FolderDocumentModification($request);
}
/**
* @return string the path to the upload directory where files are stored, without final slash
*/
public function getUploadDir()
{
return THELIA_LOCAL_DIR . 'media'.DS.'documents'.DS.'folder';
}
/**
* @param int $objectId the ID of the parent object
* @return string the URL to redirect to after update from the back-office
*/
public function getRedirectionUrl($objectId)
{
return '/admin/folder/update/' . $objectId . '?current_tab=image';
}
/**
* Get the Query instance for this object
*
* @return ModelCriteria
*/
public function getQueryInstance()
{
return FolderDocumentQuery::create();
}
}

View File

@@ -2,14 +2,20 @@
namespace Thelia\Model;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Router;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Files\FileModelParentInterface;
use Thelia\Form\BaseForm;
use Thelia\Form\FolderImageModification;
use Thelia\Model\Base\FolderImage as BaseFolderImage;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
use Thelia\Model\Breadcrumb\FolderBreadcrumbTrait;
use Thelia\Files\FileModelInterface;
class FolderImage extends BaseFolderImage implements BreadcrumbInterface
class FolderImage extends BaseFolderImage implements BreadcrumbInterface, FileModelInterface
{
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
use \Thelia\Model\Tools\PositionManagementTrait;
@@ -17,6 +23,8 @@ class FolderImage extends BaseFolderImage implements BreadcrumbInterface
/**
* Calculate next position relative to our parent
*
* @param FolderImageQuery $query
*/
protected function addCriteriaToPositionQuery($query)
{
@@ -34,11 +42,7 @@ class FolderImage extends BaseFolderImage implements BreadcrumbInterface
}
/**
* Set Image parent id
*
* @param int $parentId parent id
*
* @return $this
* @inheritdoc
*/
public function setParentId($parentId)
{
@@ -48,9 +52,7 @@ class FolderImage extends BaseFolderImage implements BreadcrumbInterface
}
/**
* Get Image parent id
*
* @return int parent id
* @inheritdoc
*/
public function getParentId()
{
@@ -69,13 +71,67 @@ class FolderImage extends BaseFolderImage implements BreadcrumbInterface
}
/**
*
* return the complete breadcrumb for a given resource.
*
* @return array
* @inheritdoc
*/
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab)
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale)
{
return $this->getFolderBreadcrumb($router, $container, $tab);
return $this->getFolderBreadcrumb($router, $container, $tab, $locale);
}
/**
* @return FileModelParentInterface the parent file model
*/
public function getParentFileModel()
{
return new Folder();
}
/**
* Get the ID of the form used to change this object information
*
* @return BaseForm the form
*/
public function getUpdateFormId()
{
return 'thelia.admin.folder.image.modification';
}
/**
* Get the form instance used to change this object information
*
* @param \Thelia\Core\HttpFoundation\Request $request
*
* @return BaseForm the form
*/
public function getUpdateFormInstance(Request $request)
{
return new FolderImageModification($request);
}
/**
* @return string the path to the upload directory where files are stored, without final slash
*/
public function getUploadDir()
{
return THELIA_LOCAL_DIR . 'media'.DS.'images'.DS.'folder';
}
/**
* @param int $objectId the ID of the parent object
* @return string the URL to redirect to after update from the back-office
*/
public function getRedirectionUrl($objectId)
{
return '/admin/folder/update/' . $objectId . '?current_tab=image';
}
/**
* Get the Query instance for this object
*
* @return ModelCriteria
*/
public function getQueryInstance()
{
return FolderImageQuery::create();
}
}

View File

@@ -4,7 +4,6 @@ namespace Thelia\Model;
use Thelia\Model\Base\OrderVersionQuery as BaseOrderVersionQuery;
/**
* Skeleton subclass for performing query and update operations on the 'order_version' table.
*

View File

@@ -3,6 +3,7 @@
namespace Thelia\Model;
use Propel\Runtime\Exception\PropelException;
use Thelia\Files\FileModelParentInterface;
use Thelia\Model\Base\Product as BaseProduct;
use Thelia\TaxEngine\Calculator;
@@ -13,7 +14,7 @@ use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Propel;
use Thelia\Model\Map\ProductTableMap;
class Product extends BaseProduct
class Product extends BaseProduct implements FileModelParentInterface
{
use \Thelia\Model\Tools\ModelEventDispatcherTrait;

View File

@@ -2,16 +2,22 @@
namespace Thelia\Model;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Router;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Files\FileModelParentInterface;
use Thelia\Form\BaseForm;
use Thelia\Form\ProductDocumentModification;
use Thelia\Model\Base\ProductDocument as BaseProductDocument;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
use Thelia\Model\Breadcrumb\CatalogBreadcrumbTrait;
use Thelia\Files\FileModelInterface;
use Thelia\Model\Tools\PositionManagementTrait;
use Thelia\Model\Tools\ModelEventDispatcherTrait;
class ProductDocument extends BaseProductDocument implements BreadcrumbInterface
class ProductDocument extends BaseProductDocument implements BreadcrumbInterface, FileModelInterface
{
use ModelEventDispatcherTrait;
use PositionManagementTrait;
@@ -19,6 +25,8 @@ class ProductDocument extends BaseProductDocument implements BreadcrumbInterface
/**
* Calculate next position relative to our parent
*
* @param ProductDocumentQuery $query
*/
protected function addCriteriaToPositionQuery($query)
{
@@ -36,11 +44,7 @@ class ProductDocument extends BaseProductDocument implements BreadcrumbInterface
}
/**
* Set Document parent id
*
* @param int $parentId parent id
*
* @return $this
* @inheritdoc
*/
public function setParentId($parentId)
{
@@ -50,9 +54,7 @@ class ProductDocument extends BaseProductDocument implements BreadcrumbInterface
}
/**
* Get Document parent id
*
* @return int parent id
* @inheritdoc
*/
public function getParentId()
{
@@ -71,13 +73,68 @@ class ProductDocument extends BaseProductDocument implements BreadcrumbInterface
}
/**
*
* return the complete breadcrumb for a given resource.
*
* @return array
* @inheritdoc
*/
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab)
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale)
{
return $this->getProductBreadcrumb($router, $container, $tab);
return $this->getProductBreadcrumb($router, $container, $tab, $locale);
}
/**
* @return FileModelParentInterface the parent file model
*/
public function getParentFileModel()
{
return new Product();
}
/**
* Get the ID of the form used to change this object information
*
* @return BaseForm the form
*/
public function getUpdateFormId()
{
return 'thelia.admin.product.document.modification';
}
/**
* Get the form instance used to change this object information
*
* @param \Thelia\Core\HttpFoundation\Request $request
*
* @return BaseForm the form
*/
public function getUpdateFormInstance(Request $request)
{
return new ProductDocumentModification($request);
}
/**
* @return string the path to the upload directory where files are stored, without final slash
*/
public function getUploadDir()
{
return THELIA_LOCAL_DIR . 'media'.DS.'documents'.DS.'product';
}
/**
* @param int $objectId the ID of the object
*
* @return string the URL to redirect to after update from the back-office
*/
public function getRedirectionUrl($objectId)
{
return '/admin/products/update?product_id=' . $objectId . '?current_tab=document';
}
/**
* Get the Query instance for this object
*
* @return ModelCriteria
*/
public function getQueryInstance()
{
return ProductDocumentQuery::create();
}
}

View File

@@ -2,16 +2,21 @@
namespace Thelia\Model;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Router;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Form\BaseForm;
use Thelia\Form\ProductImageModification;
use Thelia\Model\Base\ProductImage as BaseProductImage;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Breadcrumb\BreadcrumbInterface;
use Thelia\Model\Breadcrumb\CatalogBreadcrumbTrait;
use Thelia\Files\FileModelInterface;
use Thelia\Model\Tools\ModelEventDispatcherTrait;
use Thelia\Model\Tools\PositionManagementTrait;
class ProductImage extends BaseProductImage implements BreadcrumbInterface
class ProductImage extends BaseProductImage implements BreadcrumbInterface, FileModelInterface
{
use ModelEventDispatcherTrait;
use PositionManagementTrait;
@@ -19,6 +24,8 @@ class ProductImage extends BaseProductImage implements BreadcrumbInterface
/**
* Calculate next position relative to our parent
*
* @param ProductImageQuery $query
*/
protected function addCriteriaToPositionQuery($query)
{
@@ -26,7 +33,7 @@ class ProductImage extends BaseProductImage implements BreadcrumbInterface
}
/**
* {@inheritDoc}
* @inheritDoc
*/
public function preInsert(ConnectionInterface $con = null)
{
@@ -36,11 +43,7 @@ class ProductImage extends BaseProductImage implements BreadcrumbInterface
}
/**
* Set Image parent id
*
* @param int $parentId parent id
*
* @return $this
* @inheritdoc
*/
public function setParentId($parentId)
{
@@ -50,9 +53,7 @@ class ProductImage extends BaseProductImage implements BreadcrumbInterface
}
/**
* Get Image parent id
*
* @return int parent id
* @inheritdoc
*/
public function getParentId()
{
@@ -71,13 +72,68 @@ class ProductImage extends BaseProductImage implements BreadcrumbInterface
}
/**
*
* return the complete breadcrumb for a given resource.
*
* @return array
* @inheritdoc
*/
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab)
public function getBreadcrumb(Router $router, ContainerInterface $container, $tab, $locale)
{
return $this->getProductBreadcrumb($router, $container, $tab);
return $this->getProductBreadcrumb($router, $container, $tab, $locale);
}
/**
* @return FileModelParentInterface the parent file model
*/
public function getParentFileModel()
{
return new Product();
}
/**
* Get the ID of the form used to change this object information
*
* @return BaseForm the form
*/
public function getUpdateFormId()
{
return 'thelia.admin.product.image.modification';
}
/**
* Get the form instance used to change this object information
*
* @param \Thelia\Core\HttpFoundation\Request $request
*
* @return BaseForm the form
*/
public function getUpdateFormInstance(Request $request)
{
return new ProductImageModification($request);
}
/**
* @return string the path to the upload directory where files are stored, without final slash
*/
public function getUploadDir()
{
return THELIA_LOCAL_DIR . 'media'.DS.'images'.DS.'product';
}
/**
* @param int $objectId the ID of the object
*
* @return string the URL to redirect to after update from the back-office
*/
public function getRedirectionUrl($objectId)
{
return '/admin/products/update?product_id=' . $objectId . '?current_tab=image';
}
/**
* Get the Query instance for this object
*
* @return ModelCriteria
*/
public function getQueryInstance()
{
return ProductImageQuery::create();
}
}