public function Match($relation_name = null, $relation_col = "StockID", $match_col = "StockID")
    {
        // Try to determine relation name
        if (!$relation_name && !$this->ProductClass) {
            $relation_name = "Product";
        } elseif (!$relation_name && $this->ProductClass) {
            $relation_name = $this->ProductClass;
        }
        
        return $relation_name::get()
            ->filter($relation_col, $this->$match_col)
            ->first();
    }
public function Match($relation_name = null, $relation_col = "StockID", $match_col = "StockID")
    {
        // Try to determine relation name
        if (!$relation_name && !$this->ProductClass) {
            $relation_name = "Product";
        } elseif (!$relation_name && $this->ProductClass) {
            $relation_name = $this->ProductClass;
        }
        
        return $relation_name::get()
            ->filter($relation_col, $this->$match_col)
            ->first();
    }
public function Match ( $ relation_name = null , $ relation_col = "StockID" , $ match_col = "StockID" ) { // Try to determine relation name if ( ! $ relation_name && ! $ this -> ProductClass ) { $ relation_name = "Product" ; } elseif ( ! $ relation_name && $ this -> ProductClass ) { $ relation_name = $ this -> ProductClass ; } return $ relation_name :: get ( ) -> filter ( $ relation_col , $ this -> $ match_col ) -> first ( ) ; }
Match this item to another object in the Database, by the
provided details.

@param $relation_name = The class name of the related dataobject
@param $relation_col = The column name of the related object
@param $match_col = The column we use to match the two objects
@return DataObject
Match this item to another object in the Database by the provided details .