Creating a miniature module
For the purpose of this chapter, we will create a miniature module called Foggyline_Office
.
The module will have two entities defined as follows:
Department
: a simple model with the following fields:entity_id
: primary keyname
: name of department, string value
Employee
: an EAV model with the following fields and attributes:- Fields:
entity_id
: primary keydepartment_id
: foreign key, pointing toDepartment.entity_id
email
: unique e-mail of an employee, string valuefirst_name
: first name of an employee, string valuelast_name
: last name of an employee, string value
- Attributes:
service_years
: employee's years of service, integer valuedob
: employee's date of birth, date-time valuesalary
– monthly salary, decimal valuevat_number
: VAT number, (short) string valuenote
: possible note on employee, (long) string value
- Fields:
Every module starts with the registration.php
and module.xml
files. For the purpose of our chapter module, let's create the app/code/Foggyline...