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

skipAttributes should respect columnMapping #12975

Closed
CameronHall opened this Issue Jul 20, 2017 · 2 comments

Comments

Projects
3 participants
@CameronHall
Copy link
Member

CameronHall commented Jul 20, 2017

Previously discussed in #485

Expected and Actual Behavior

When settings skipAttributes, I should be able to specify the column names defined in the column map opposed to having to use the real names.

class User extends Phalcon\Mvc\Model
{
	const TABLE_NAME = 'tblUsers';

	public $idColumn;
	public $firstName;
	public $lastName;

	public function intialize()
	{
		$this->useDynamicUpdate(true);
		$this->keepSnapshots(true);

		$eventsManager = $this->getDI()->getShared('eventsManager');

		//Attach an anonymous function as a listener for "model" events
		$eventsManager->attach('model', function($event, $model) {
			// There's nothing to do here tbh
			return true;
		});

		//Attach the events manager to the event
		$this->setEventsManager($eventsManager);
		unset($eventsManager);

		//Call the Base Models initialize() method to perform the normal routine
		$this->setReadConnectionService('db');
		$this->setWriteConnectionService('db');

		$this->skipAttributes('idColumn');
	}

	public function columnMap()
	{
		return [
			'id' => 'idColumn',
			'first_name' => 'firstName',
			'last_name' => 'firstName',
		];
	}

	public function getSource()
	{
		return self::TABLE_NAME;
	}
}

Details

  • Phalcon version: 3.2.1
  • PHP Version: 5.6.16
  • Operating System: Windows 10
  • Installation type: DLL
  • Zephir version (if any): N\A
  • Server: Apache
  • Other related info (Database, table schema): MySQL

@stale stale bot added the stale label Apr 16, 2018

@sergeyklay sergeyklay closed this Apr 16, 2018

@CameronHall

This comment has been minimized.

Copy link
Member Author

CameronHall commented Apr 16, 2018

Hey guys,

This can be up for discussion, although I believe this is a valid feature request and should be reopened.

Thanks :)

@niden niden reopened this Nov 29, 2018

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

@niden niden added this to the 4.0.0 milestone Nov 29, 2018

@niden niden added this to In progress in 4.0 Release Nov 29, 2018

@phalcon phalcon deleted a comment from stale bot Dec 9, 2018

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

This comment has been minimized.

Copy link
Member

niden commented Dec 24, 2018

@niden niden closed this Dec 24, 2018

4.0 Release automation moved this from In progress to Done 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