original_string: public function leftJoinWith($assoc, callable $builder = null)
      {
          $result = $this->getEagerLoader()
              ->setMatching($assoc, $builder, [
                  'joinType' => QueryInterface::JOIN_TYPE_LEFT,
                  'fields' => false
              ])
              ->getMatching();
          $this->_addAssociationsToTypeMap($this->getRepository(), $this->getTypeMap(), $result);
          $this->_dirty();
  
          return $this;
      }
code: public function leftJoinWith($assoc, callable $builder = null)
      {
          $result = $this->getEagerLoader()
              ->setMatching($assoc, $builder, [
                  'joinType' => QueryInterface::JOIN_TYPE_LEFT,
                  'fields' => false
              ])
              ->getMatching();
          $this->_addAssociationsToTypeMap($this->getRepository(), $this->getTypeMap(), $result);
          $this->_dirty();
  
          return $this;
      }
code_tokens: public function leftJoinWith ( $ assoc , callable $ builder = null ) { $ result = $ this -> getEagerLoader ( ) -> setMatching ( $ assoc , $ builder , [ 'joinType' => QueryInterface :: JOIN_TYPE_LEFT , 'fields' => false ] ) -> getMatching ( ) ; $ this -> _addAssociationsToTypeMap ( $ this -> getRepository ( ) , $ this -> getTypeMap ( ) , $ result ) ; $ this -> _dirty ( ) ; return $ this ; }
docstring: Creates a LEFT JOIN with the passed association table while preserving
  the foreign key matching and the custom conditions that were originally set
  for it.
  
  This function will add entries in the `contain` graph.
  
  ### Example:
  
  ```
  // Get the count of articles per user
  $usersQuery
  ->select(['total_articles' => $query->func()->count('Articles.id')])
  ->leftJoinWith('Articles')
  ->group(['Users.id'])
  ->enableAutoFields(true);
  ```
  
  You can also customize the conditions passed to the LEFT JOIN:
  
  ```
  // Get the count of articles per user with at least 5 votes
  $usersQuery
  ->select(['total_articles' => $query->func()->count('Articles.id')])
  ->leftJoinWith('Articles', function ($q) {
  return $q->where(['Articles.votes >=' => 5]);
  })
  ->group(['Users.id'])
  ->enableAutoFields(true);
  ```
  
  This will create the following SQL:
  
  ```
  SELECT COUNT(Articles.id) AS total_articles, Users.*
  FROM users Users
  LEFT JOIN articles Articles ON Articles.user_id = Users.id AND Articles.votes >= 5
  GROUP BY USers.id
  ```
  
  It is possible to left join deep associations by using dot notation
  
  ### Example:
  
  ```
  // Total comments in articles by 'markstory'
  $query
  ->select(['total_comments' => $query->func()->count('Comments.id')])
  ->leftJoinWith('Comments.Users', function ($q) {
  return $q->where(['username' => 'markstory']);
  )
  ->group(['Users.id']);
  ```
  
  Please note that the query passed to the closure will only accept calling
  `select`, `where`, `andWhere` and `orWhere` on it. If you wish to
  add more complex clauses you can do it directly in the main query.
  
  @param string $assoc The association to join with
  @param callable|null $builder a function that will receive a pre-made query object
  that can be used to add custom conditions or selecting some fields
  @return $this
docstring_tokens: Creates a LEFT JOIN with the passed association table while preserving the foreign key matching and the custom conditions that were originally set for it .