O'Reilly logo

Learning Phalcon PHP by Calin Rada

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

Category CRUD

When we created the architecture for category tables, we added a category_translation table. We will alter this table and add a unique index to avoid duplicates for the same country code and category ID. Execute the following query:

ALTER TABLE  `learning_phalcon`.`category_translation` ADD UNIQUE (
`category_translation_category_id` ,
`category_translation_lang`
) COMMENT  '';

We will add a new array to the config/config.php global configuration file that will hold information about i18n:

'i18n' => [
  'locales' => [ //ISO 639-1: two-letter codes, one per language
    'en' => 'English'
  ]
]

The Category form

We will now create the form for the add/edit categories. Create a new file in modules/Core/Forms/, name it CategoryForm.php, and write the ...

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