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 · 2 comments

Comments

Projects
3 participants
@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 label Nov 29, 2018

@phalcon phalcon deleted a comment from stale bot Nov 29, 2018

@stale stale bot removed the stale label Nov 29, 2018

@niden niden added this to To do in 4.0 Release Nov 29, 2018

@niden niden self-assigned this Nov 29, 2018

@niden niden added the Bug - Medium label Nov 29, 2018

@CameronHall

This comment has been minimized.

Copy link
Member

CameronHall commented Dec 5, 2018

@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

Fixes phalcon#12975, phalcon#13477: allowEmptyStrings & skipAttribute…
…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

Fixes phalcon#12975, phalcon#13477: allowEmptyStrings & skipAttribute…
…s adhere col map

allowEmptyStrings and skipAttributes will follow the column mapping from now on.

niden added a commit that referenced this issue Dec 24, 2018

Fixes #12975, #13477: allowEmptyStrings & skipAttributes adhere col map
allowEmptyStrings and skipAttributes will follow the column mapping from now on.

@niden niden moved this from To do to Done in 4.0 Release Dec 24, 2018

@niden

This comment has been minimized.

Copy link
Member

niden commented Dec 24, 2018

Addressed in #13692

@niden niden closed this Dec 24, 2018

niden added a commit to niden/cphalcon that referenced this issue Dec 24, 2018

[4.0.x] - Merge remote-tracking branch 'upstream/4.0.x' into 4.0.x
* upstream/4.0.x:
  Fixes phalcon#12975, phalcon#13477: allowEmptyStrings & skipAttributes adhere col map

niden added a commit to niden/cphalcon that referenced this issue Dec 24, 2018

[phalcon#13684] - Merge branch '4.0.x' into T13684-license-and-tests
* 4.0.x:
  Fixes phalcon#12975, phalcon#13477: allowEmptyStrings & skipAttributes adhere col map

niden added a commit to niden/cphalcon that referenced this issue Dec 24, 2018

[phalcon#13680] - Merge branch '4.0.x' into T13680-breadcrumbs-component
* 4.0.x:
  Fixes phalcon#12975, phalcon#13477: allowEmptyStrings & skipAttributes adhere col map

niden added a commit to niden/cphalcon that referenced this issue Dec 24, 2018

[phalcon#13660] - Merge branch '4.0.x' into T13660-volt-macro-paramet…
…er-null

* 4.0.x:
  Fixes phalcon#12975, phalcon#13477: allowEmptyStrings & skipAttributes adhere col map

niden added a commit to niden/cphalcon that referenced this issue Dec 24, 2018

[phalcon#13495] - Merge branch '4.0.x' into T13495-url-double-slashes
* 4.0.x:
  Fixes phalcon#12975, phalcon#13477: allowEmptyStrings & skipAttributes adhere col map

niden added a commit to niden/cphalcon that referenced this issue Dec 24, 2018

[phalcon#13341] - Merge branch '4.0.x' into T13341-type-javascript
* 4.0.x:
  Fixes phalcon#12975, phalcon#13477: allowEmptyStrings & skipAttributes adhere col map

niden added a commit to niden/cphalcon that referenced this issue Dec 24, 2018

[phalcon#10406] - Merge branch '4.0.x' into T10406-model-collection-i…
…nterfaces

* 4.0.x:
  Fixes phalcon#12975, phalcon#13477: allowEmptyStrings & skipAttributes adhere col map

niden added a commit to niden/cphalcon that referenced this issue Dec 24, 2018

[phalcon#12676] - Merge branch '4.0.x' into T12676-add-methods-to-int…
…erfaces

* 4.0.x:
  Fixes phalcon#12975, phalcon#13477: allowEmptyStrings & skipAttributes adhere col map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment