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

allowEmptyStringValues() does not accept custom property/column names #13477

Closed
mohahn opened this issue Aug 31, 2018 · 4 comments
Closed

allowEmptyStringValues() does not accept custom property/column names #13477

mohahn opened this issue Aug 31, 2018 · 4 comments
Assignees
Labels
bug A bug report status: medium Medium

Comments

@mohahn
Copy link

mohahn commented Aug 31, 2018

I'm using Phalcon 3.4.0
Regarding #440 I'm not happy with the solution of using allowEmptyStringValues() but as it's the only solution it should use custom property names.
When using a database table with underscore in column names (i.e. match_type) I'm able to create the following model

class Campaign extends Model {
   protected $matchType;
   public function columnMap() {
      return [ 'match_type' => 'matchType' ];
   }
}

When defining relationships inside initialize() method I'm able to use this camel-case notation for columns, but when using allowEmptyStringValues([ 'matchType' ]) this does not work. I'm still getting validation error, that matchType is required. This empty-string workaround is only working when using real table column names, like allowEmptyStringValues([ 'match_type' ]).
So when I'm allowed to use camel-case notation for defining relationships to other models, I should be able to use property names defined by columnMap() in allowEmptyStringValues(), also. Please change this behaviour.

@stale stale bot added the stale Stale issue - automatically closed label Nov 29, 2018
@phalcon phalcon deleted a comment from stale bot Nov 29, 2018
@stale stale bot removed the stale Stale issue - automatically closed label Nov 29, 2018
@niden niden self-assigned this Nov 29, 2018
@CameronHall
Copy link
Contributor

@niden I may as well fix this when I do #12975

CameronHall added a commit to CameronHall/cphalcon that referenced this issue Dec 24, 2018
…s adhere col map

allowEmptyStrings and skipAttributes will follow the column mapping from now on.
CameronHall added a commit to CameronHall/cphalcon that referenced this issue Dec 24, 2018
…s adhere col map

allowEmptyStrings and skipAttributes will follow the column mapping from now on.
niden pushed a commit that referenced this issue Dec 24, 2018
allowEmptyStrings and skipAttributes will follow the column mapping from now on.
@niden
Copy link
Member

niden commented Dec 24, 2018

Addressed in #13692

@niden niden closed this as completed Dec 24, 2018
@niden niden added the 4.0 label Jun 21, 2019
@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
@wurst-hans
Copy link

This is still an issue in Phalcon 4.0.4
allowEmptyStringValues does not recognize columnMap() I have to use real column name instead.

@ros-infobest
Copy link

ros-infobest commented Sep 28, 2022

allowEmptyStringValues(), from the name it does allow empty string by excluding column if it is empty but PHPDOcs block made me confuse that it says it skip on update but when field has other than empty value it allows to update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

5 participants