This website uses Cookies to provide you with the best possible service. Please see our Privacy Policy for more information. Click the check box below to accept cookies. Then confirm with a click on "Save".  
Status: 2025-02-06

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 …
    }
}