Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
sCreateRewriteTableArticles example
$elementId
,
$shopId
]
=
$this
->
SeoIndex
(
)
->
getCachedTime
(
)
;
$this
->
SeoIndex
(
)
->
setCachedTime
(
$currentTime
->
format
(
'Y-m-d H:i:s'
)
,
$elementId
,
$shopId
)
;
$this
->
RewriteTable
(
)
->
baseSetup
(
)
;
$limit
= 10000;
$lastId
= null;
$lastUpdateVal
= '0000-00-00 00:00:00';
do
{
$lastUpdateVal
=
$this
->
RewriteTable
(
)
->
sCreateRewriteTableArticles
(
$lastUpdateVal
,
$limit
)
;
$lastId
=
$this
->
RewriteTable
(
)
->
getRewriteArticleslastId
(
)
;
}
while
(
$lastId
!== null
)
;
$this
->
SeoIndex
(
)
->
setCachedTime
(
$currentTime
->
format
(
'Y-m-d H:i:s'
)
,
$elementId
,
$shopId
)
;
$context
=
$this
->
get
(
ContextServiceInterface::
class
)
->
createShopContext
(
$shopId
)
;
$this
->
RewriteTable
(
)
->
sCreateRewriteTableCategories
(
)
;
$this
->
RewriteTable
(
)
->
sCreateRewriteTableCampaigns
(
)
;
$this
->
RewriteTable
(
)
->
sCreateRewriteTableContent
(
)
;
$this
->
RewriteTable
(
)
->
sCreateRewriteTableBlog
(
null, null,
$context
)
;
public
function
sCreateRewriteTable
(
$lastUpdate
)
{
$this
->
baseSetup
(
)
;
$context
=
$this
->contextService->
createShopContext
(
Shopware
(
)
->
Shop
(
)
->
getId
(
)
)
;
$this
->
sCreateRewriteTableCleanup
(
)
;
$this
->
sCreateRewriteTableStatic
(
)
;
$this
->
sCreateRewriteTableCategories
(
)
;
$this
->
sCreateRewriteTableBlog
(
null, null,
$context
)
;
$this
->
sCreateRewriteTableCampaigns
(
)
;
$lastUpdate
=
$this
->
sCreateRewriteTableArticles
(
$lastUpdate
)
;
$this
->
sCreateRewriteTableContent
(
null, null,
$context
)
;
$this
->
createManufacturerUrls
(
$context
)
;
$this
->
createContentTypeUrls
(
$context
)
;
return
$lastUpdate
;
}
/** * Cleanup the rewrite table from non-existing resources. * * @throws Zend_Db_Adapter_Exception */
$elementId
,
$shopId
]
=
$this
->seoIndex->
getCachedTime
(
)
;
$this
->seoIndex->
setCachedTime
(
$currentTime
->
format
(
'Y-m-d H:i:s'
)
,
$elementId
,
$shopId
)
;
$this
->rewriteTable->
baseSetup
(
)
;
$limit
= 10000;
$lastId
= null;
$lastUpdateVal
= '0000-00-00 00:00:00';
do
{
$lastUpdateVal
=
$this
->rewriteTable->
sCreateRewriteTableArticles
(
$lastUpdateVal
,
$limit
)
;
$lastId
=
$this
->rewriteTable->
getRewriteArticleslastId
(
)
;
}
while
(
$lastId
!== null
)
;
$this
->seoIndex->
setCachedTime
(
$currentTime
->
format
(
'Y-m-d H:i:s'
)
,
$elementId
,
$shopId
)
;
$context
=
$this
->container->
get
(
ContextServiceInterface::
class
)
->
createShopContext
(
$shopId
)
;
$this
->rewriteTable->
sCreateRewriteTableCategories
(
)
;
$this
->rewriteTable->
sCreateRewriteTableCampaigns
(
)
;
$this
->rewriteTable->
sCreateRewriteTableContent
(
)
;
$this
->rewriteTable->
sCreateRewriteTableBlog
(
null, null,
$context
)
;