Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 1.63 KB

File metadata and controls

55 lines (39 loc) · 1.63 KB

Model


Quick start

creates Model Bar in the given module Foo

php emvicy module:createModel Bar Foo
  • If module Foo does not exist, it will be created as a primary if possible, otherwise as a secondary one.

Find out more about Models, for example on wikipedia, "Model–view–controller#Model", 2023-12-28


Class

There are no specific restrictions regarding a model class. For example, methods can have any visibility, the class can also follow the singleton pattern, etc.

writing the Model class

Illustration: Module Foo, Model Bar with static method doSomething

<?php

namespace Foo\Model;

class Bar
{
    /**
     * @param int $iValue
     * @return void
     */
    public static function doSomething(int $iValue)
    {
        // your code …
    }
}