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

isNullValue fails on newly-created entity for null attributes #157

Closed
MordantWastrel opened this issue Oct 6, 2021 · 0 comments
Closed

Comments

@MordantWastrel
Copy link
Contributor

In working with a Quick entity and mementifier, we've noticed that if you call getMemento() on an entity you just created where some of the values are not populated (i.e. actually null rather than the empty-string null you get when loading an entity from the DB), this function on BaseEntity will fail:

	public boolean function isNullValue( required string key, any value ) {
		param arguments.value = invoke( this, "get" & arguments.key );
		var alias             = retrieveAliasForColumn( arguments.key );
		if ( !isSimpleValue( arguments.value ) ) {
			return false;
		}
		return variables._nullValues.keyExists( alias ) &&
		compare( variables._nullValues[ alias ], arguments.value ) == 0;
	}

With the error: The required parameter [arguments.value] was not provided

In other words, if your User entity has firstname and lastname and you create a new user with only a firstname and then call getMemento() it will fail on that IsNullValue function call for lastname.

Not a problem when loading an existing entity because hydration takes care of all the null values.

@elpete elpete closed this as completed Dec 6, 2023
elpete added a commit that referenced this issue Dec 21, 2023
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

2 participants