Git Product home page Git Product logo

Comments (6)

iurijacob avatar iurijacob commented on August 30, 2024

Solved #2

from ar-position.

klimov-paul avatar klimov-paul commented on August 30, 2024

Empty value for the attribute not always means it is actually null. For example: 0 value can be a valid one.

I assume you have this problem, because you collect group attribute data from a web form.
You should setup a filter validator, which will typecast empty string ('') into null in such case.

from ar-position.

iurijacob avatar iurijacob commented on August 30, 2024

Actually my group attribute is a nullable foreign key, which means that some entities have a category and some not, and it will never have a 0 value.

But I used empty() instead of is_null() because for some reason the line $this->owner->$attribute; was returning an empty string, not a null value as it was supposed to, based on my db data.

Anyway, You´re right, It´s still a bug. I'll figure out a solution for the zero's case.

from ar-position.

iurijacob avatar iurijacob commented on August 30, 2024

0 is not the same as empty, though php evaluates that way. But even assuming it's the same, your code should handle with this instead of behaving randomly.

By the way, my group attribute is not coming from a web form, it's a foreign key.

from ar-position.

klimov-paul avatar klimov-paul commented on August 30, 2024

it's the same, your code should handle with this instead of behaving randomly.

Seems you are not paying attention: you are not only developer in this world, remember?
For someone else values like 0 or empty string `` can be considered as valid, and their typecast is not desiarable.

my group attribute is not coming from a web form, it's a foreign key.

Then how it becomes empty, but NOT null?
If the group attribute value is set to null it is handled correctly. You should check your code, so it ensures empty value conversion or correct null setup.

from ar-position.

iurijacob avatar iurijacob commented on August 30, 2024

Then how it becomes empty, but NOT null?

It's a good question. Maybe you are right, Maybe I have a bug in my code. But it flees entirely to the main subject. your code doesn´t handle well with empty values. Period.

Seems you are not paying attention: you are not only developer in this world, remember?

Really? keep your buggy code then.
What a waste of time...

from ar-position.

Related Issues (8)

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.