Tries to find a bean with certain properties specified in the second
parameter ($like). If the bean is found, it will be returned.
If multiple beans are found, only the first will be returned.
If no beans match the criteria, a new bean will be dispensed,
the criteria will be imported as properties and this new bean
will be stored and returned.
Format of criteria set: property => value
The criteria set also supports OR-conditions: property => array( value1, orValue2 )
public findOrCreate ( string $type, array $like = [] ) : redbeanphp\OODBBean | ||
$type | string | type of bean to search for |
$like | array | criteria set describing bean to search for |
return | redbeanphp\OODBBean |