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

Possibly mistake on docs? #11

Closed
r-martins opened this issue Jun 3, 2022 · 3 comments
Closed

Possibly mistake on docs? #11

r-martins opened this issue Jun 3, 2022 · 3 comments

Comments

@r-martins
Copy link

I was following the docs scrictly (I reckon) and wasn't able to create a block.
Finally I realized the docs led me to create the patch file under /Data/Setup/Patch/Data/MyClass.php.

But it only works if I create under <module/Setup/Patch/Data/MyClass.php.

Maybe I missed some other point here, but...

@markshust
Copy link
Owner

Yes, the first examples for creating, updating, & deleting blocks use setup patch data scripts, so they would need to be at the Setup/Patch/Data location. That said, there are also examples of using these simple methods with dependency injection at https://github.com/markshust/magento2-module-simpledata#example-using-dependency-injection

@r-martins
Copy link
Author

Just to make it clear, the problem I pointed was an extra /Data/ in the docs. Not the fact of it was using the old Setup-way of doing things.
Never mind.. maybe I did some confusion, but sorted that out anyway.

@markshust
Copy link
Owner

Ah ok, no worrries! "data" setup patch scripts typically go in a Setup/Patch/Data directory... but I can see how that can be confused with the name of this module being Data. I should have picked a better name! 😅

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

No branches or pull requests

2 participants