<commit_before>﻿The YAML mapping driver enables you to provide the ODM metadata in form of YAML documents.

The YAML mapping document of a class is loaded on-demand the first time it is requested and subsequently stored in the metadata cache. In order to work, this requires certain conventions:

 * Each document/mapped superclass must get its own dedicated YAML mapping document.
 * The name of the mapping document must consist of the fully qualified name of the class, where namespace separators are replaced by dots (.).
 * All mapping documents should get the extension ".dcm.yml" to identify it as a Doctrine mapping file. This is more of a convention and you are not forced to do this. You can change the file extension easily enough.

-

    [php]
    $driver->setFileExtension('.yml');

It is recommended to put all YAML mapping documents in a single folder but you can spread the documents over several folders if you want to. In order to tell the YamlDriver where to look for your mapping documents, supply an array of paths as the first argument of the constructor, like this:

    [php]
    // $config instanceof Doctrine\ORM\Configuration
    $driver = new YamlDriver(array('/path/to/files'));
    $config->setMetadataDriverImpl($driver);


++ Example

As a quick start, here is a small example document that makes use of several common elements:

    [yml]
    // Documents.User.dcm.yml
    Documents\User:
      db: documents
      collection: user
      fields:
	    id:
		  fieldName: id
		  id: true
		username:
		  fieldName: username
		  type: string
		createdAt:
		  fieldName: createdAt
		  type: date
        address:
          fieldName: address
          targetEntity: Documents\Address
          embedded: true
          type: one
        profile:
          fieldName: profile
          targetEntity: Documents\Profile
          reference: true
		  cascade: all
          type: one
        phonenumbers:
          fieldName: phonenumbers
          targetEntity: Documents\Phonenumber
          embedded: true
          type: many
        group:
          fieldName: group
          targetEntity: Documents\Group
          reference: true
          cascade: all
          type: many
        account:
          fieldName: account
          targetEntity: Documents\Account
          reference: true
          cascade: all
          type: one<commit_msg>fixed intendation in yaml doc file<commit_after>﻿The YAML mapping driver enables you to provide the ODM metadata in form of YAML documents.

The YAML mapping document of a class is loaded on-demand the first time it is requested and subsequently stored in the metadata cache. In order to work, this requires certain conventions:

 * Each document/mapped superclass must get its own dedicated YAML mapping document.
 * The name of the mapping document must consist of the fully qualified name of the class, where namespace separators are replaced by dots (.).
 * All mapping documents should get the extension ".dcm.yml" to identify it as a Doctrine mapping file. This is more of a convention and you are not forced to do this. You can change the file extension easily enough.

-

    [php]
    $driver->setFileExtension('.yml');

It is recommended to put all YAML mapping documents in a single folder but you can spread the documents over several folders if you want to. In order to tell the YamlDriver where to look for your mapping documents, supply an array of paths as the first argument of the constructor, like this:

    [php]
    // $config instanceof Doctrine\ORM\Configuration
    $driver = new YamlDriver(array('/path/to/files'));
    $config->setMetadataDriverImpl($driver);


++ Example

As a quick start, here is a small example document that makes use of several common elements:

    [yml]
    // Documents.User.dcm.yml
    Documents\User:
      db: documents
      collection: user
      fields:
        id:
          fieldName: id
          id: true
        username:
          fieldName: username
          type: string
        createdAt:
          fieldName: createdAt
          type: date
        address:
          fieldName: address
          targetEntity: Documents\Address
          embedded: true
          type: one
        profile:
          fieldName: profile
          targetEntity: Documents\Profile
          reference: true
          cascade: all
          type: one
        phonenumbers:
          fieldName: phonenumbers
          targetEntity: Documents\Phonenumber
          embedded: true
          type: many
        group:
          fieldName: group
          targetEntity: Documents\Group
          reference: true
          cascade: all
          type: many
        account:
          fieldName: account
          targetEntity: Documents\Account
          reference: true
          cascade: all
          type: one
{'fraction_non_alphanumeric': 0.05213074058750517, 'fraction_numerical': 0.0, 'mean_word_length': 2.3929824561403508, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7217312', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1136, 'n_words': 552}