Sets the related products
13984
protected function setDataRelatedIndexProduct()
    {
        $products = $this->getRelatedProduct();

        if (!empty($products)) {

            $pager_options = array(
                'key' => 'rlp',
                'total' => count($products),
                'limit' => $this->config('related_pager_limit', 4)
            );

            $pager = $this->getPager($pager_options);

            if (!empty($pager['limit'])) {
                list($from, $to) = $pager['limit'];
                $products = array_slice($products, $from, $to);
            }

            $data = array(
                'products' => $products,
                'pager' => $pager['rendered']
            );

            $this->setData('related', $this->render('product/related', $data));
        }
    }
942930
public function setRelated($value)
    {
        $this->loadData(true);

        if (is_null($value)) {
            $value = [];
        }

        if (!is_array($value)) {
            throw new RelationException("HasMany relation can only be set with array of entities");
        }

        //Do not add items twice
        $matched = [];
        foreach ($value as $index => $item) {
            if (is_null($item)) {
                unset($value[$index]);
                continue;
            }

            $this->assertValid($item);
            if (!empty($instance = $this->matchOne($item))) {
                $matched[] = $instance;
                unset($value[$index]);
            }
        }

        $this->deleteInstances = array_diff($this->instances, $matched);
        $this->instances = $matched + $value;
    }
1057078
protected function setRelations(Jory $jory): void
    {
        $relations = $this->getArrayValue($this->joryArray, 'rlt');

        if ($relations) {
            $relations = $this->convertDotNotatedRelations($relations);
            foreach ($relations as $name => $joryData) {
                $subJory = (new self($joryData))->getJory();
                $jory->addRelation(new Relation($name, $subJory));
            }
        }
    }
41747
protected function setConnectedRelationOptions()
    {
        $foreignKey = $this->defaultOptions['foreign_key'];

        if (! $this->db->isTableExists($table = $this->defaultOptions['pivot_table'])) {
            $table = $this->options['pivot_table'] = $this->command->choice(
                "Can't find table {$this->text['pivot_table']} as {$this->text['pivot_text']}, what are you using?",
                $this->getTables()
            );

            $this->text['pivot_table'] = "[".$this->command->paintString($table, 'green')."]";
            $name = Str::singular($table);
            $foreignKey = $name.'_id';
        }

        if (! $this->db->isFieldExists($table, $foreignKey)) {
            $this->options['foreign_key'] = $this->command->choice(
                "Can't find field {$this->text['foreign_key']} in the table {$this->text['pivot_table']} as {$this->text['foreign_text']} of table {$this->text['to_table']}, choice one!",
                $this->getFields($table)
            );
        }

        if (! $this->db->isFieldExists($table, $this->defaultOptions['related_key'])) {
            $this->options['related_key'] = $this->command->choice(
                "Can't find field {$this->text['related_key']} in the table {$this->text['pivot_table']} as {$this->text['related_text']} of table {$this->text['table']}, choice one!",
                $this->getFields($table)
            );
        }
    }
290687
public void setRelatedResources(java.util.Collection<RelatedResource> relatedResources) {
        if (relatedResources == null) {
            this.relatedResources = null;
            return;
        }

        this.relatedResources = new java.util.ArrayList<RelatedResource>(relatedResources);
    }
352158
protected function set_items() {
		$home_label = $this->get_home_label();

		if ( is_front_page() ) {
			$this->set( $home_label );
		} else {
			$this->set( $home_label, home_url() );
		}
	}
744105
function getRelated() {
  var relatedValues = getValue(this, 'see');
  if (relatedValues && relatedValues.trim().length > 0) {
    var relatedItems = relatedValues.split(',').map((relatedItem) => relatedItem.trim());
    return relatedItems.map((relatedItem) => '[' + relatedItem + '](#' + relatedItem + ')');
  } else {
    return [];
  }
}
353256
public function add_related_objects() {

		PodsField_Pick::$related_objects['table'] = array(
			'label' => __( 'Database Tables', 'pods' ),
			'group' => __( 'Advanced Objects', 'pods' ),
		);

		if ( is_multisite() ) {
			PodsField_Pick::$related_objects['site'] = array(
				'label' => __( 'Multisite Sites', 'pods' ),
				'group' => __( 'Advanced Objects', 'pods' ),
			);

			PodsField_Pick::$related_objects['network'] = array(
				'label' => __( 'Multisite Networks', 'pods' ),
				'group' => __( 'Advanced Objects', 'pods' ),
			);
		}

		PodsField_Pick::$related_objects['theme'] = array(
			'label'         => __( 'Themes', 'pods' ),
			'group'         => __( 'Advanced Objects', 'pods' ),
			'simple'        => true,
			'data_callback' => array( $this, 'data_themes' ),
		);

		PodsField_Pick::$related_objects['page-template'] = array(
			'label'         => __( 'Page Templates', 'pods' ),
			'group'         => __( 'Advanced Objects', 'pods' ),
			'simple'        => true,
			'data_callback' => array( $this, 'data_page_templates' ),
		);

		PodsField_Pick::$related_objects['sidebar'] = array(
			'label'         => __( 'Sidebars', 'pods' ),
			'group'         => __( 'Advanced Objects', 'pods' ),
			'simple'        => true,
			'data_callback' => array( $this, 'data_sidebars' ),
		);

		PodsField_Pick::$related_objects['post-types'] = array(
			'label'         => __( 'Post Type Objects', 'pods' ),
			'group'         => __( 'Advanced Objects', 'pods' ),
			'simple'        => true,
			'data_callback' => array( $this, 'data_post_types' ),
		);

		PodsField_Pick::$related_objects['taxonomies'] = array(
			'label'         => __( 'Taxonomy Objects', 'pods' ),
			'group'         => __( 'Advanced Objects', 'pods' ),
			'simple'        => true,
			'data_callback' => array( $this, 'data_taxonomies' ),
		);
	}
371987
def set_relationship(module_name, module_id, link_field_name, related_ids, opts={})
    login! unless logged_in?
    options = { 
      :name_value_list => [], 
      :delete => 0, 
    }.merge! opts
    raise ArgumentError, "related_ids must be an Array" unless related_ids.class == Array
    json = <<-EOF
      {
        "session": "#{@sugar_session_id}",
        "module_name": "#{module_name}",
        "module_id": "#{module_id}",
        "link_field_name": "#{link_field_name}",
        "related_ids": #{related_ids.to_json},
        "name_value_list": #{options[:name_value_list].to_json},
        "delete": #{options[:delete]}  
      }
    EOF
    json.gsub!(/^\s{6}/,'')
    # TODO:  Add a handler for the response.  By default it returns a hash like:
    # {failed => 0, deleted => 0, created => 1}.  We should add this to the 
    # Response.handle method and return true/false depending on the outcome.
    send!(:set_relationship, json)
  end
477016
def filter_products(self, desired_prods):
        """"""

        self.filter_prods = True
        self.desired_prods = set(desired_prods)
429483
protected function setConnectedRelationOptions()
    {
        parent::setConnectedRelationOptions();

        if (! $this->db->isFieldExists($table = $this->model->getTable(), $this->defaultOptions['primary_key'])) {
            $this->options['primary_key'] = $this->command->choice(
                "Can't find field {$this->text['primary_key']} in the table {$this->text['table']} as {$this->text['primary_text']}, choice one!",
                $this->getFields($table)
            );
        }
    }
1181210
def set_relationships(module_names, module_ids, link_field_names, related_ids)
    login! unless logged_in?
    
    [module_names, module_ids, link_field_names, related_ids].each do |arg|
      raise ArgumentError, "argument must be an Array" unless arg.class == Array
    end
    
    json = <<-EOF
      {
        "session": "#{@sugar_session_id}",
        "module_names": "#{module_names.to_json}",
        "module_ids": #{module_ids.to_json},
        "link_field_names": #{link_field_names.to_json},
        "related_ids": #{related_ids.to_json}   
      }
    EOF
    json.gsub!(/^\s{6}/,'')
    send!(:set_relationships, json)
  end
1069223
private function setItemsInformation()
    {
        foreach ($this->_checkoutSession->getLastRealOrder()->getAllVisibleItems() as $product) {
            $this->_paymentRequest->addItems()->withParameters(
                $product->getProduct()->getId(), //id
                \UOL\PagSeguro\Helper\Data::fixStringLength($product->getName(), 255), //description
                $product->getSimpleQtyToShip(), //quantity
                \UOL\PagSeguro\Helper\Data::toFloat($product->getPrice()), //amount
                round($product->getWeight()) //weight
            );
        }
    }
1167033
public function setProduct($product)
    {
        $this->id = $product->getId();
        $this->sku = $product->getSku();
        $this->name = $product->getName();

        $this->status = $this->statusFactory->create()
            ->getOptionText($product->getStatus());

        $options = $this->visibilityFactory->create()
            ->getOptionArray();
        $this->visibility = (string)$options[$product->getVisibility()];

        $this->getMinPrices($product);

        $this->url = $this->urlFinder->fetchFor($product);

        $this->imagePath = $this->mediaConfigFactory->create()
            ->getMediaUrl($product->getSmallImage());

        $this->stock = (float)number_format($this->getStockQty($product), 2, '.', '');

        $shortDescription = $product->getShortDescription();
        //limit short description
        if ($this->stringUtils->strlen($shortDescription) > \Dotdigitalgroup\Email\Helper\Data::DM_FIELD_LIMIT) {
            $shortDescription = mb_substr($shortDescription, 0, \Dotdigitalgroup\Email\Helper\Data::DM_FIELD_LIMIT);
        }

        $this->shortDescription = $shortDescription;

        //category data
        $count = 0;
        $categoryCollection = $product->getCategoryCollection()
            ->addNameToResult();
        foreach ($categoryCollection as $cat) {
            $this->categories[$count]['Id'] = $cat->getId();
            $this->categories[$count]['Name'] = $cat->getName();
            ++$count;
        }

        //website data
        $count = 0;
        $websiteIds = $product->getWebsiteIds();
        foreach ($websiteIds as $websiteId) {
            $website = $this->storeManager->getWebsite(
                $websiteId
            );
            $this->websites[$count]['Id'] = $website->getId();
            $this->websites[$count]['Name'] = $website->getName();
            ++$count;
        }

        $this->processProductOptions($product);

        unset(
            $this->itemFactory,
            $this->mediaConfigFactory,
            $this->visibilityFactory,
            $this->statusFactory,
            $this->helper,
            $this->storeManager
        );

        return $this;
    }
1149282
@Override
    public boolean setProductCoefficients(Double[] coefficients) {
        boolean result = products.setMultipliers(coefficients);
        notifyChanged();
        return result;
    }
545872
protected function setBreadcrumbEditProduct()
    {
        $breadcrumbs = array();

        $breadcrumbs[] = array(
            'url' => $this->url('admin'),
            'text' => $this->text('Dashboard')
        );

        $breadcrumbs[] = array(
            'text' => $this->text('Products'),
            'url' => $this->url('admin/content/product')
        );

        $this->setBreadcrumbs($breadcrumbs);
    }
1331212
@Override
  public final void setItem(final SeGoods pSeGoods) {
    this.item = pSeGoods;
    if (this.itsId == null) {
      this.itsId = new SeGoodsPriceId();
    }
    this.itsId.setItem(this.item);
  }