O'Reilly logo

Magento 2 Developer's Guide by Branko Ajzele

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Entity CRUD actions

Up to this point, we have learned how to create a simple model, an EAV model, and install and upgrade types of schema and data script. Now, let us see how we can create, read, update and delete our entities, operations that are commonly referred to as CRUD.

Though this chapter is about models, collections, and related things, for the purpose of demonstration, let's make a tiny detour into routes and controllers. The idea is to create a simple Test controller with the Crud action we can trigger in the browser via a URL. Within this Crud action, we will then dump our CRUD-related code.

To make Magento respond to the URL we punch into the browser, we need to define the route. We do so by creating the app/code/Foggyline/Office/etc/frontend/routes.xml ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required