findByRequiresParameter() public static method

public static findByRequiresParameter ( string $methodName ) : MongoDBException
$methodName string
return MongoDBException
 /**
  * Adds support for magic finders.
  *
  * @param string $method
  * @param array $arguments
  * @throws MongoDBException
  * @throws \BadMethodCallException If the method called is an invalid find* method
  *                                 or no find* method at all and therefore an invalid
  *                                 method call.
  * @return array|object The found document/documents.
  */
 public function __call($method, $arguments)
 {
     if (substr($method, 0, 6) == 'findBy') {
         $by = substr($method, 6, strlen($method));
         $method = 'findBy';
     } elseif (substr($method, 0, 9) == 'findOneBy') {
         $by = substr($method, 9, strlen($method));
         $method = 'findOneBy';
     } else {
         throw new \BadMethodCallException("Undefined method '{$method}'. The method name must start with " . "either findBy or findOneBy!");
     }
     if (!isset($arguments[0])) {
         throw MongoDBException::findByRequiresParameter($method . $by);
     }
     $fieldName = lcfirst(\Doctrine\Common\Util\Inflector::classify($by));
     if ($this->class->hasField($fieldName)) {
         return $this->{$method}(array($fieldName => $arguments[0]));
     } else {
         throw MongoDBException::invalidFindByCall($this->documentName, $fieldName, $method . $by);
     }
 }
 /**
  * Adds support for magic finders.
  *
  * @param string $method
  * @param array $arguments
  * @throws MongoDBException
  * @throws \BadMethodCallException If the method called is an invalid find* method
  *                                 or no find* method at all and therefore an invalid
  *                                 method call.
  * @return array|object The found document/documents.
  */
 public function __call($method, $arguments)
 {
     if (strpos($method, 'findBy') === 0) {
         $by = substr($method, 6, strlen($method));
         $method = 'findBy';
     } elseif (strpos($method, 'findOneBy') === 0) {
         $by = substr($method, 9, strlen($method));
         $method = 'findOneBy';
     } else {
         throw new \BadMethodCallException("Undefined method: '{$method}'. The method name must start with 'findBy' or 'findOneBy'!");
     }
     if (!isset($arguments[0])) {
         throw MongoDBException::findByRequiresParameter($method . $by);
     }
     $fieldName = Inflector::camelize($by);
     if ($this->class->hasField($fieldName)) {
         return $this->{$method}(array($fieldName => $arguments[0]));
     } else {
         throw MongoDBException::invalidFindByCall($this->documentName, $fieldName, $method . $by);
     }
 }