{"id":28591569,"url":"https://github.com/monarc-project/zm-core","last_synced_at":"2025-08-07T04:41:57.464Z","repository":{"id":37413099,"uuid":"96313196","full_name":"monarc-project/zm-core","owner":"monarc-project","description":"Core part of the backend of MONARC","archived":false,"fork":false,"pushed_at":"2025-05-16T17:49:29.000Z","size":9122,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-16T18:42:12.437Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/monarc-project.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-07-05T11:44:19.000Z","updated_at":"2025-05-16T17:49:32.000Z","dependencies_parsed_at":"2025-04-16T11:11:20.424Z","dependency_job_id":null,"html_url":"https://github.com/monarc-project/zm-core","commit_stats":{"total_commits":2103,"total_committers":23,"mean_commits":91.43478260869566,"dds":0.8174037089871612,"last_synced_commit":"d0abecf7c47c1ad411138dd58e615678ab3b4e53"},"previous_names":[],"tags_count":65,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monarc-project%2Fzm-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monarc-project%2Fzm-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monarc-project%2Fzm-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monarc-project%2Fzm-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monarc-project","download_url":"https://codeload.github.com/monarc-project/zm-core/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monarc-project%2Fzm-core/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259239416,"owners_count":22826920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-11T09:36:13.606Z","updated_at":"2025-06-11T09:36:22.267Z","avatar_url":"https://github.com/monarc-project.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"MONARC Core project\n===================\n\n\nDevelopment notes concerning the following:\n\n* Entity\n* Table\n* Controller\n* Service\n* Container configuration in module.config.php\n* Tests Coverage\n\nEntity\n------\n\nCreation of entities should be performed as a simple object instantiation, e.g.\n\n    $myEntityClass = (new MyEntityClass())\n        -\u003esetName('name')\n        -\u003esetCode('codde');\n\nThe entity should have a single responsibility and do not perform any database related operations itself. \n\n`Note!` The `AbstractEntity` inheritance is going to be removed and the entities filters methods cleaned uo.  \n\n\nFor generating migrating file \u0026 migrate DB with adding/deleting/changing column:\n\n    php ./vendor/bin/doctrine-module migrations:diff\n    php ./vendor/bin/doctrine-module migrations:migrate\n\n\nEntity Table\n------------\n\nImplementation of table (repositories) classes are done in Model/Table folder and extend `AbstractTable`.\n\nIn the table constructor there is mandatory to pass an entity class name that the table is responsible to manage, e.g. \n\n    public function __construct(EntityManager $entityManager)\n    {\n        parent::__construct($entityManager, \\MyEntityNamespace\\MyEntityClass::class);\n    }\n\nThe table methods, responsible for fetching data from the DB should start from `findBy` prefix. \nAbstractTable has methods, which help with the basic entities operations. \n\n* save\n* remove\n* and so on.\n\nIn the module config file there is required to define an way of the table class creation.\nIn most of the cases it works well with `Laminas\\Di\\Container\\AutowireFactory`:\n\n    \\MyEntityNamespace\\MyEntityClass::class =\u003e AutowireFactory::class,\n\n\nController\n----------\n\nOne of the controller can be extend when particular ones created:\n- `Laminas\\Mvc\\Controller\\AbstractRestfulController`\n- `Monarc\\Core\\Controller\\Handler\\AbstractRestfulControllerRequestHandler`\n\nThere is a trait helper class that can be used in the controllers to help with the output rendering:\n`Monarc\\Core\\Controller\\Handler\\ControllerRequestResponseHandlerTrait`\n\n\nRestful application methods to be defined:\n\n* getList()\n* get($id)\n* create($data)\n* update($id, $data)\n* delete($id)\n\nIn `module.config.php`, controllers are usually defined in the configuration like:\n\n    ControllerNameSpace\\MyController::class =\u003e AutowireFactory::class,\n\n\nService\n-------\n\n`Note` New created services classes should not extend `AbstractService`, is going to be be removed in the future.\n\n\nIn the module config file the services container looks like:  \n\n    ServiceNamescpace\\MyService::class =\u003e Laminas\\Di\\Container\\AutowireFactory::class,\n\nor, in case if config needs to be injected:\n\n    ServiceNamescpace\\MyService::class =\u003e Laminas\\ServiceManager\\AbstractFactory\\ReflectionBasedAbstractFactory::class,\n\n\nInput Formatters\n-------\n\nThe input formatters classes aim to perform the [GET] requests data filtering, validating and transforming into a format that can be used directly to prepare the database queries.\nThe formatters classes are enriched with possibilities of handling and preparing the data for search by text, filter by params, ordering and pagination.\n\nTha basic classes are `InputFormatter\\AbstractInputFormatter`, `InputFormatter\\FormattedInputParams`.\nThe instantiated objects inherited the basic classes are used in the Controllers and the formatted results are passed to the services and to the table classes methods.\nThe tables' classes, inherited the `Table\\AbstractTable` have a certain method `findByParams` where the `FormattedInputParams` object is accepted and processed to generate the query.  \n\nThe trait's method `Controller\\Handler\\ControllerRequestResponseHandlerTrait::getFormattedInputParams` helps in the process.\n\n\nValidators\n-------\n\nThe validators classes are responsible to validate the post, put and patch requests' data. \nEvery child class of `Validator\\InputValidator\\AbstractInputValidator` have to describe a set rules that are used to validate the incoming data.  \nThe validated data can be obtained with use of the methods `getValidData`, `getValidDataSets` if `isValid` result is `true`.\n\nThe trait's method `Controller\\Handler\\ControllerRequestResponseHandlerTrait::validatePostParams` helps in the process.\nIt can also handle the batch data requests, that are used for the import operations.\n\n\nTests Coverage\n--------------\n\nThe implementation is partially done on MonarcAppFO side, because integration and functional tests should cover the both Core and FrontOffice modules of the MONARC application.\n\nUnit tests can be implemented at a particular projects side.\n\nWe might move from the current Core/FrontOffice modules approach to a libraries/responsibility specific and the tests will be moved as well. \n\n\nLicense\n-------\n\nThis software is licensed under\n[GNU Affero General Public License version 3](http://www.gnu.org/licenses/agpl-3.0.html)\n\n- Copyright (C) 2022-2024 Luxembourg House of Cybersecurity https://lhc.lu\n- Copyright (C) 2016-2022 SMILE gie securitymadein.lu\n- Copyright (C) 2016-2024 Jérôme Lombardi - https://github.com/jerolomb\n- Copyright (C) 2016-2024 Juan Rocha - https://github.com/jfrocha\n- Copyright (C) 2017-2024 Cédric Bonhomme - https://www.cedricbonhomme.org\n- Copyright (C) 2019-2024 Ruslan Baidan - https://github.com/ruslanbaidan\n- Copyright (C) 2016-2017 Guillaume Lesniak\n- Copyright (C) 2016-2017 Thomas Metois\n- Copyright (C) 2016-2017 Jérôme De Almeida\n\nFor more information, [the list of authors and contributors](AUTHORS) is available.\n\nDisclaimer: This program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU Affero General Public License for more details.\n\n\n\n[^1]: https://stevenwilliamalexander.wordpress.com/2013/09/25/zf2-restful-api-example/\n[^2]: https://www.youtube.com/watch?v=CGEDNMzWoFk\n[^3]: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html\n\n[1]: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonarc-project%2Fzm-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonarc-project%2Fzm-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonarc-project%2Fzm-core/lists"}