Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sortable behavior not working with ENUM scope #987

Open
pimpreneil opened this issue Jun 25, 2015 · 1 comment
Open

Sortable behavior not working with ENUM scope #987

pimpreneil opened this issue Jun 25, 2015 · 1 comment

Comments

@pimpreneil
Copy link

When adding a sortable behavior scopped to a column that has a ENUM type, the rank is wrong on creation (and on all the futher rank manipulations done on the object).

A simple workaround is to override the getScopeValue method in your object class.

In the base class, the method looks like this:

public function getScopeValue($returnNulls = true)
{
    return $this->get{MyEnumColumn}();
}

So you have to override the method to make this method return the actual SQL value corresponding to your enum value like so:

public function getScopeValue($returnNulls = true)
{
    return {MyObject}Peer::get{MyEnumColumn}SqlValue($this->get{MyEnumColumn}());
}

I know that this version of Propel is frozen so I won't make any PR regarding this issue.
I don't know if this issue is fixed in Propel2, but I am still posting this simple trick here, it could help people still using this last stable version of Propel...

@pimpreneil
Copy link
Author

FYI, I reproduced the problem on Propel2. I will report it there as well...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant