source/Spiral/ORM/Entities/Relations/MultipleRelation.php
public function matchOne($query)
    {
        foreach ($this->loadData(true)->instances as $instance) {
            if ($this->match($instance, $query)) {
                return $instance;
            }
        }

        return null;
    }
public function matchOne($query)
    {
        foreach ($this->loadData(true)->instances as $instance) {
            if ($this->match($instance, $query)) {
                return $instance;
            }
        }

        return null;
    }
public function matchOne ( $ query ) { foreach ( $ this -> loadData ( true ) -> instances as $ instance ) { if ( $ this -> match ( $ instance , $ query ) ) { return $ instance ; } } return null ; }
Fine one entity for a given query or return null. Method will autoload data.

Example: ->matchOne(['value' => 'something', ...]);

@param array|RecordInterface|mixed $query Fields, entity or PK.

@return RecordInterface|null
Fine one entity for a given query or return null . Method will autoload data .