Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First-time Magento 2 setups fail if they include a category creation #121

Closed
TiEul opened this issue Sep 16, 2016 · 5 comments
Closed

First-time Magento 2 setups fail if they include a category creation #121

TiEul opened this issue Sep 16, 2016 · 5 comments

Comments

@TiEul
Copy link

TiEul commented Sep 16, 2016

During a first-time setup of Magento, for example when deploying a pre-existing codebase to a new environment, the ElasticSuite module will cause an exception to be thrown if any of the custom setups include a category creation. This cannot be solved by setting the indexers to "scheduled" since the indexer namespace for the the magento binary only becomes available after the first setup has finished, meaning the setup will end up in a deadlock.

@afoucret
Copy link
Contributor

Hi @TiEul,

Where did you create the category (InstallSchema or InstallData script) ?

BR,

@TiEul
Copy link
Author

TiEul commented Sep 20, 2016

Hey @afoucret,

they category creations take place in Data scripts. The temporary workaround I came up with looks like this, by the way,

@romainruaud
Copy link
Collaborator

Hello @TiEul .

I am unfortunately unable to reproduce your issue.

What I do :

I create a raw Magento 2.1 instance with a composer-create-project.
I add smile/elasticsuite 2.2.x to the required modules.
I add a module creating a dummy category (copy pasted your module):

if (version_compare($context->getVersion(), '2.0.0', '<')) {
            $category = $this->categoryFactory->create();
            $category->loadByAttribute('name', 'Homepage Highlighted Products');
            if ($category == false || $category->getId() == false) {
                $category = $this->categoryFactory->create();
                $category->setIsActive(true);
                $category->setName('Homepage Highlighted Products');
                $category->setIncludeInMenu(false);
                $this->categoryRepository->save($category);
            }
        }

I run the bin/magento setup:install on the command line.

No problem occurs. Install finishes properly and I can see my category is created.

Elasticsearch is running locally of course, before running the setup. But after the install procedure, no index is created. Indexers are indicated as "invalid" in the back-office as expected after a fresh install.

Are you sure you are using the last version of 2.2.x branch ? For me, this bug has been fixed since the merge of #110 into master and 2.2.x.

Regards,

A

@romainruaud
Copy link
Collaborator

Now I'll need more informations about the error message you observe, and also the setup process which is running in your environment.

Regards,

@TiEul
Copy link
Author

TiEul commented Sep 20, 2016

Hey Romain,

thanks for your help, I just updated our composer.json so that we are now grabbing v2.2.5 instead of 2.2.1, I will let you know if that solves the problem.

Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants