Giter VIP home page Giter VIP logo

wmmodel's Introduction

wmmodel's People

Contributors

akasake avatar dieterholvoet avatar frizinak avatar hnln avatar robinhoutevelts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wmmodel's Issues

Make argument resolving of FormStateInterface optional

Summary

I think we should remove this line:

is_a($argument->getType(), FormStateInterface::class, true)

from ModelValueResolver. I'm not against what it does, I just think wmmodel isn't the right place for that. I think a core patch for this issue in the relevant projects would be better.

Add PHPStan to coding standard fixers

  • Add phpstan.neon config file referencing the wmcodestyle rule files (example)
  • Add phpstan analyse to the coding-standards composer script
  • Add autoload-dev entry to ensure autoloading during analysis

ModelValueResolver resolves same argument multiple times

Description

The ModelValueResolver resolves the same argument multiple times in some cases.

Steps to reproduce

For instance with this controller:

class Controller {
    public function show(Page $a, Page $b) {}
}

and this route:

my_route:
    path: 'foobar/{a}/{b}'
    defaults:
        _controller: 'Controller::show'
    options:
        parameters:
            a: {type: 'entity:node'}
            b: {type: 'entity:node'}

And then visiting /foobar/123/456

Expected result

I expect that when the show method of my controller is called, the$b argument is resolved to a Node with id 456.

Actual result

The $a and $b argument are the same.

Make overriding AccountProxy optional

I think we should remove the AccountProxy override. This changes core logic, which might break stuff on certain installations. Looking at the code, I'm also not sure whether it's still necessary. The only difference with the core logic I can spot is that in case the user is anonymous, a AnonymousUserSession object is returned instead of a UserInterface object. Is that really necessary?

Make models Drupal plugins

Summary

Make models Drupal plugins.

Motivation

Instead of using our custom ModelFinder service, we should use the built-in plugin discovery of Drupal. The entity type and bundle would become parameters of the annotation. This way we can also get rid of the getModelInfo, entityType, bundleName, bundleDeduceRegex and snake methods on the WmModel trait.

Update README

Description

In #17 (comment) we prepared this module for Drupal 9.3 and it became patch-less ๐ŸŽ‰

However we haven't updated the README to reflect you no longer need to use a patch.

Add module to Drupal.org

  • Rename module to entity_model
  • Create the Drupal project (example)
  • Change the license to GPLv2 to comply with Drupal.org requirements (example)
  • Update the composer install command in the README
  • Add contributing section to the README ([example](wieni/dead_letter_queue@a0b0f79
  • Create releases for existing tags on Drupal.org

ModelValueResolver resolves for optional parameters

Description

The ModelValueResolver resolves for optional parameters.

Steps to reproduce

Assume we have a route to move the relation between tags.

foo.mark_tag_as_root:
    path: /move/{tag}
    options:
        parameters:
            tag: {type: 'entity:taxonomy_term'}

foo.mark_tag_as_child:
    path: /move/{tag}/{parentTag}
    options:
        parameters:
            tag: {type: 'entity:taxonomy_term'}
            parentTag: {type: 'entity:taxonomy_term'}

And this controller method:

public function move(Tag $tag, ?Tag $parentTag = null): void
{
    if (!$parentTag) {
        // Mark $tag as root
    } else {
        // Mark $tag as child of $parentTag
    }
}

Expected result

When I visit /move/123, I expect:

  • My Controller method to be called
  • $tag to be a Term with id 123
  • $parentTag to be null.

Actual result

$parentTag is the same as $tag instead of null

No singularize

When working with node bundle "Vacature" and "Vacatures" the singularizing in the wmmodel cause key clashing and missed mapping. I would suggest taking out any singularizing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.