Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 670 Bytes

08_identifiable.md

File metadata and controls

33 lines (26 loc) · 670 Bytes

Identifiable

The Identifiable behavior automatically saves an identifier in the document.

NOTE: This behavior only can be used with EmbeddedDocuments

Configuration

array(
    'Model\Article' => array(
        'fields' => array(
            'field' => 'string',
        ),
        'behaviors' => array(
            array(
                'class' => 'Mongator\Behavior\Identifiable', 
                'options' => array(
                )
            ),
        ),
    ),
);

Options

  • idField (default 'token'): field used to store the id
  • idGeneratorMethod (default null): callable that returns the id