/** * @param AbstractCollection $collection * * @return $this */ public function applyToCollection($collection) { if ($this->getTable() && $this->getPkFieldName()) { $collection->joinTable($this->getTable(), $this->getPkFieldName() . '=entity_id', ['affected_product_id' => $this->getPkFieldName()]); } return $this; }