承接 csoellinger/silverstripe-model-annotations-task 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

csoellinger/silverstripe-model-annotations-task

Composer 安装命令:

composer require csoellinger/silverstripe-model-annotations-task

包简介

A SilverStripe Task to generate data object model annotations for defined db fields including fields defined in extensions.

README 文档

README

Build Status codecov Scrutinizer Code Quality

This module adds a dev task which generates annotations for your data object models. The problem is if you are working a lot with silver stripe models you will learn that no IDE can handle the DB fields as properties and/or collections as methods. So i made this task which completes my models with annotations from existing configs of the model itself and all extensions of it. Configs handled: db, has_one, has_many, many_many, many_many(through), belongs_to, belongs_many_many.

  1. Requirements
  2. Installation
  3. Usage
    1. Web
    2. Terminal
    3. Optional params
  4. Options
    1. dryRun (default: true)
    2. quiet (default: false)
    3. createBackupFile (default: false)
    4. addUseStatements (default: false)
  5. Example
  6. Documentation
  7. License
  8. Maintainers
  9. Bugtracker
  10. Development and contribution

Requirements

  • PHP 7.4 - PHP 8.0
  • PHP-AST extension
  • PHP-BCMATH extension
  • SilverStripe ^4.10

Installation

composer require --dev csoellinger/silverstripe-model-annotations-task

Usage

Run dev build to load the task and after you can execute it in your browser or cli.

Web

http://localhost/tasks/ModelAnnotationsTask

Terminal

vendor/bin/sake dev/tasks/ModelAnnotationsTask

Optional params

  • dryRun=0/1
  • quiet=0/1
  • createBackupFile=0/1
  • addUseStatements=0/1

Take a look at options section below to get more information about the params.

Options

All optional params from above can be set as silverstripe config at the ModelAnnotationsTask. Only difference is that the config is set as boolean var and not as integer. By default dryRun is set to true. If you want write the files with this task you need to set the config or set the param to false.

dryRun (default: true)

Only print the changes inside your browser or terminal and don't write any file.

quiet (default: false)

No output.

createBackupFile (default: false)

Create a backup file before writing the model. Only if dryRun is false.

addUseStatements (default: false)

Collect data types which are not declared as use statement and add them to the file. If this config is true it also shortens the data types.

Example

Here you see a small example how it will look your model file after using the task.

Your Input

<?php

class Player extends DataObject
{
    private static $db = [
        'Name' => 'Varchar(255)',
    ];
    private static $has_many = [
        'Jobs' => 'Job',
    ];
}

Task would write this file:

<?php

/**
 * @property string $Name Name...
 *
 * @method HasManyList Jobs() Get jobs
 */
class Player extends DataObject
{
    private static $db = [
        'Name' => 'Varchar(255)',
    ];
    private static $has_many = [
        'Jobs' => 'Job',
    ];
}

Documentation

License

See License

Maintainers

Bugtracker

Bugs are tracked in the issues section of this repository. Before submitting an issue please read over existing issues to ensure yours is unique.

If the issue does look like a new bug:

  • Create a new issue
  • Describe the steps required to reproduce your issue, and the expected outcome. Unit tests, screenshots and screencasts can help here.
  • Describe your environment as detailed as possible: SilverStripe version, Browser, PHP version, Operating System, any installed SilverStripe modules.

Please report security issues to the module maintainers directly. Please don't file security issues in the bugtracker.

Development and contribution

If you would like to make contributions to the module please ensure you raise a pull request and discuss with the module maintainers.

统计信息

  • 总下载量: 22
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2022-04-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固