code: private function visitAssociation($className, $association = null)
      {
          if (null === $association) {
              if (isset($this->visitedAssociations[$className])) {
                  return false;
              }
  
              $this->visitedAssociations[$className] = [];
  
              return true;
          }
  
          if (isset($this->visitedAssociations[$className][$association])) {
              return false;
          }
  
          if (! isset($this->visitedAssociations[$className])) {
              $this->visitedAssociations[$className] = [];
          }
  
          $this->visitedAssociations[$className][$association] = true;
  
          return true;
      }
docs: Visit a given association and mark it as visited
  
  @param string      $className
  @param string|null $association
  
  @return bool true if the association was visited before