set default folder for contents
This commit is contained in:
committed by
Julien Chanseaume
parent
0610b8037a
commit
2f5c3ee5ea
@@ -20,6 +20,7 @@
|
|||||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
/* */
|
/* */
|
||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
use Thelia\Model\ContentFolderQuery;
|
||||||
use Thelia\Model\ProductAssociatedContent;
|
use Thelia\Model\ProductAssociatedContent;
|
||||||
|
|
||||||
if (php_sapi_name() != 'cli') {
|
if (php_sapi_name() != 'cli') {
|
||||||
@@ -502,13 +503,24 @@ function createContents($faker, $folders, $con)
|
|||||||
|
|
||||||
// folder
|
// folder
|
||||||
$contentFolders = explode(';', $data[7]);
|
$contentFolders = explode(';', $data[7]);
|
||||||
|
$defaultFolder = null;
|
||||||
foreach ($contentFolders as $contentFolder) {
|
foreach ($contentFolders as $contentFolder) {
|
||||||
$contentFolder = trim($contentFolder);
|
$contentFolder = trim($contentFolder);
|
||||||
if (array_key_exists($contentFolder, $folders)) {
|
if (array_key_exists($contentFolder, $folders)) {
|
||||||
$content->addFolder($folders[$contentFolder]);
|
$content->addFolder($folders[$contentFolder]);
|
||||||
|
if (null === $defaultFolder) {
|
||||||
|
$defaultFolder = $folders[$contentFolder]->getId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$content
|
||||||
|
->getContentFolders()
|
||||||
|
->getFirst()
|
||||||
|
->setDefaultFolder(true)
|
||||||
|
->save($con)
|
||||||
|
;
|
||||||
|
|
||||||
$content->save($con);
|
$content->save($con);
|
||||||
|
|
||||||
$images = explode(';', $data[6]);
|
$images = explode(';', $data[6]);
|
||||||
|
|||||||
Reference in New Issue
Block a user