code: public function getAssignmentById($id)
      {
          foreach ($this->unit->getStockAssignments() as &$assignment) {
              if ($assignment->getId() === $id) {
                  return $assignment;
              }
          }
  
          return null;
      }
docs: Returns the stock assignment by its ID.
  
  @param int $id
  
  @return \Ekyna\Component\Commerce\Stock\Model\StockAssignmentInterface|null