Giter Site home page Giter Site logo

API review about doctrine-specification HOT 8 CLOSED

happyr avatar happyr commented on June 2, 2024
API review

from doctrine-specification.

Comments (8)

Nyholm avatar Nyholm commented on June 2, 2024

I have noticed a few things. Please discuss them, I love to hear some inputs.

A) The Expression interface should be renamed to "Filter" to make sense. Also the method names referring to that interface should (of course) be renamed.
B) The both Modifier interfaces should be renamed to something more descriptive. Like QueryModifier and ResultModifier. I'm getting confused 😕
C) I want to rewrite BaseSpecification somehow.. But I think I need to try it out more first.. I'll get back..
D) Nice @cakper for running return $query->execute(); instead of return $query->getResult($query->getHydrationMode()).

from doctrine-specification.

Nyholm avatar Nyholm commented on June 2, 2024

This is another spec:

class AdvertsWeShouldClose extends BaseSpecification
{
    public function __construct($dqlAlias = null)
    {
        parent::__construct($dqlAlias);
        $this->spec = Spec::andX(
            Spec::eq('ended', 0),
            Spec::orX(
                Spec::lt('endDate', new \DateTime()),
                Spec::andX(
                    Spec::isNull('endDate'),
                    Spec::lt('startDate', new \DateTime('-4weeks'))
                )
            )
        );
    }

    /**
     * @return Expression
     */
    public function getWrappedExpression()
    {
        return $this->spec;
    }

    /**
     * @return Modifier
     */
    public function getWrappedModifier()
    {
        return $this->spec;
    }
}

This one should be valid. But LogicX does require a Specification. A `Expression´ should also work here.. I'm making a PR.

from doctrine-specification.

cakper avatar cakper commented on June 2, 2024

A) The Expression interface should be renamed to "Filter" to make sense. Also the method names referring to that interface should (of course) be renamed.

agree :)

B) The both Modifier interfaces should be renamed to something more descriptive. Like QueryModifier and ResultModifier. I'm getting confused

If you (author) are confused than definitely we should rename it because it will make even more confusion to users.

from doctrine-specification.

Nyholm avatar Nyholm commented on June 2, 2024

Okey. Thank you @cakper for your input. I'll write a PR for A & B

from doctrine-specification.

cakper avatar cakper commented on June 2, 2024

I'm just doing PR for the first one ;)

from doctrine-specification.

Nyholm avatar Nyholm commented on June 2, 2024

I'll do the second one then =)

from doctrine-specification.

Nyholm avatar Nyholm commented on June 2, 2024

It feels like every time we make an effort on this repo we find more stuff to do... But with the PRs above and a PR for (A) I feel pretty happy with the result. 😄

from doctrine-specification.

Nyholm avatar Nyholm commented on June 2, 2024

All the raised issued has gotten a PR and they are all merged. Thank you!

from doctrine-specification.

Related Issues (20)

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.