original_string: public function link(EntityInterface $sourceEntity, array $targetEntities, array $options = [])
      {
          $this->_checkPersistenceStatus($sourceEntity, $targetEntities);
          $property = $this->getProperty();
          $links = $sourceEntity->get($property) ?: [];
          $links = array_merge($links, $targetEntities);
          $sourceEntity->set($property, $links);
  
          return $this->junction()->getConnection()->transactional(
              function () use ($sourceEntity, $targetEntities, $options) {
                  return $this->_saveLinks($sourceEntity, $targetEntities, $options);
              }
          );
      }
code: public function link(EntityInterface $sourceEntity, array $targetEntities, array $options = [])
      {
          $this->_checkPersistenceStatus($sourceEntity, $targetEntities);
          $property = $this->getProperty();
          $links = $sourceEntity->get($property) ?: [];
          $links = array_merge($links, $targetEntities);
          $sourceEntity->set($property, $links);
  
          return $this->junction()->getConnection()->transactional(
              function () use ($sourceEntity, $targetEntities, $options) {
                  return $this->_saveLinks($sourceEntity, $targetEntities, $options);
              }
          );
      }
code_tokens: public function link ( EntityInterface $ sourceEntity , array $ targetEntities , array $ options = [ ] ) { $ this -> _checkPersistenceStatus ( $ sourceEntity , $ targetEntities ) ; $ property = $ this -> getProperty ( ) ; $ links = $ sourceEntity -> get ( $ property ) ? : [ ] ; $ links = array_merge ( $ links , $ targetEntities ) ; $ sourceEntity -> set ( $ property , $ links ) ; return $ this -> junction ( ) -> getConnection ( ) -> transactional ( function ( ) use ( $ sourceEntity , $ targetEntities , $ options ) { return $ this -> _saveLinks ( $ sourceEntity , $ targetEntities , $ options ) ; } ) ; }
docstring: Associates the source entity to each of the target entities provided by
  creating links in the junction table. Both the source entity and each of
  the target entities are assumed to be already persisted, if they are marked
  as new or their status is unknown then an exception will be thrown.
  
  When using this method, all entities in `$targetEntities` will be appended to
  the source entity's property corresponding to this association object.
  
  This method does not check link uniqueness.
  
  ### Example:
  
  ```
  $newTags = $tags->find('relevant')->toArray();
  $articles->getAssociation('tags')->link($article, $newTags);
  ```
  
  `$article->get('tags')` will contain all tags in `$newTags` after liking
  
  @param \Cake\Datasource\EntityInterface $sourceEntity the row belonging to the `source` side
  of this association
  @param array $targetEntities list of entities belonging to the `target` side
  of this association
  @param array $options list of options to be passed to the internal `save` call
  @throws \InvalidArgumentException when any of the values in $targetEntities is
  detected to not be already persisted
  @return bool true on success, false otherwise
docstring_tokens: Associates the source entity to each of the target entities provided by creating links in the junction table . Both the source entity and each of the target entities are assumed to be already persisted if they are marked as new or their status is unknown then an exception will be thrown .