$result
$result : mixed
Either Utility
The Either Utility class provides an easy way to substitute the NULL coalesce operator in RedBeanPHP (since the lazy loading interface interferes with the ?? operator) in a way that can also be used in older PHP-versions.
__construct( $result)
Constructs a new Either-instance.
Example usage:
$author = $text
->either()
->page
->book
->autor
->name
->or('unknown');
The Either-class lets you access bean properties without having to do NULL-checks. The mechanism resembles the use of the ?? somewhat but offers backward compatibility with older PHP versions. The mechanism also works on arrays.
$budget = $company
->either()
->sharedProject
->first()
->budget
->or(0);
| $result |
__get(string $something) : self
Extracts a value from the wrapped object and stores it in the internal result object. If the desired value cannot be found, the internal result object will be set to NULL. Chainable.
| string | $something | name of the property you wish to extract the value of |