Code Monkey home page Code Monkey logo

Comments (2)

rayrutjes avatar rayrutjes commented on August 25, 2024

Hi @brunonic
I was informed of your issue internally, thanks for taking the time to actually submit an issue here.

In the end, my first conclusion would be that the casting of the values only takes place when retrieving the values from the database.

Currently, we do listen for the flush event and act upon that and in that case, the cast didn't take place yet.

I will investigate this and see if we can better handle this to be more consistent.
A quick win for you would be to store your boolean values as integers (0/1) but that would force you to do the casting yourself when using the values each time unless you use non-strict equalities in your codebase.

Give me some time to look into this ;)

from search-bundle.

rayrutjes avatar rayrutjes commented on August 25, 2024

Hey @brunonic , so the thing is that we send the entity in the state it is in just before being sent to the database. My guess is that your form actually sets 1 or 0 for the visibility property.

When re-indexing everything though, the results are being fetched from the database and casted to the correct type.

To enforce the boolean, here is what I suggest you add to your entity:

/**
     * Set visible
     *
     * @param boolean $visible
     *
     * @return Product
     */
    public function setVisible($visible)
    {
        $this->visible = (bool) $visible;

        return $this;
    }

from search-bundle.

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.