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

Check if at least one property of a type is filled #13

Closed
2 tasks done
brotkrueml opened this issue Jul 3, 2019 · 0 comments
Closed
2 tasks done

Check if at least one property of a type is filled #13

brotkrueml opened this issue Jul 3, 2019 · 0 comments
Assignees
Labels
feature New feature or request
Milestone

Comments

@brotkrueml
Copy link
Owner

brotkrueml commented Jul 3, 2019

As a developer I find it useful to have a check if at least one property of a type is filled with any value.

Scenario:
I set the properties of a type from the properties of a domain model.

$contactPoint = new ContactPoint()
$contactPoint->setProperty('telephone', $model->getTelephone());
$contactPoint->setProperty('faxNumber', $model->getFaxNumber());
$contactPoint->setEmail('email', $model->getEmail());

Now I want to check if all properties of the contact point are "empty", to avoid unneccessary markup:

if (!$contactPoint->isEmpty()) {
    $organization->setProperty('contactPoint', $contactPoint);
}

Acceptance criteria:

  • A method exists to check, if at least on property in a type has a value set.
  • The API documentation is adjusted.
@brotkrueml brotkrueml added the feature New feature or request label Jul 3, 2019
@brotkrueml brotkrueml added this to the Road to version 1.0 milestone Jul 3, 2019
@brotkrueml brotkrueml self-assigned this Jul 3, 2019
brotkrueml added a commit that referenced this issue Jul 3, 2019
A new method in the AbstractType class is introduced: isEmpty(). It returns true, when each property
of the model has no value. Otherwise false.

Relates: #13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant