Содержание

Symfony YAML Configuration Reference

The schema.yml configuration file

In this article we assume that you are familiar with The YAML Format and Configuration File Principles.

The purpose of schema files is to allow you to manage your model definitions directly from a YAML file rather then editing php code. The YAML schema file is parsed and used to generate all your model definitions/classes. This makes Doctrine model definitions much more portable.

Doctrine 1.2

  # Global parameters
  detect_relations: <true | false>
  connection:       connection_name
  package:          package_name
  inheritance:      inheritance_information
  actAs:            behavior_information
  options:          options_information
  attributes:       attributes_information
 
  # Model definition
  model_name:
    connection:           connection_name
    tableName:            table_name
    className:            class_name
    abstract:             <true | false>
    listeners:            [ListenerClass1, ListenerClass2, ...]
    package:              package_name
    package_custom_path:  /path/to/generate/package
    inheritance:
      extends:         model_to_extend
      type:            <simple | concrete | column_aggregation>
      keyField:        key_field_name
      keyValue:        key_field_value
    columns:
      column_name:
        name:            column_name
        type:            <string | char | boolean | integer | float | decimal | blob | clob | enum | timestamp>
        length:          column_length
        scale:           column_scale
        values:          ['enum_value1', 'enum_value2', ...]
        default:         default_value
        unsigned:        <true | false>
        unique:          <true | false>
        primary:         <true | false>
        autoincrement:   <true | false>
        comment:         column_comment
        notnull:         <true | false>
        email:           <true | false>
        notblank:        <true | false>
        nospace:         <true | false>
        past:            <true | false>
        future:          <true | false>
        minlength:       length_value
        country:         <true | false>
        ip:              <true | false>
        htmlcolor:       <true | false>
        range:           [start_value, end_value]
        regexp:          regexp_value
        creditcard:      <true | false>
        date:            <true | false>
        usstate:         <true | false>
    relations:
      relation_name:
        local:           local_column_name
        foreign:         foreign_column_name
        type:            <one | many>
        class:           class_name
        refClass:        ref_class
        foreignType:     <one | many>
        alias:           alias
        foreignAlias:    foreign_alias
        owningSide:      <true | false>
        equal:           <true | false>
        foreignKeyName:  foreign_key_name
        onDelete:        <CASCADE | SET NULL | NO ACTION | RESTRICT | SET DEFAULT>
        onUpdate:        <CASCADE | SET NULL | NO ACTION | RESTRICT | SET DEFAULT>
        cascade:         [delete]
    indexes:
      index_name:
        type:            <unique | fulltext | gist | gin>
        fields:          [fieldname1, fieldname2, ...]
    checks:
      check_name:      check_condition
    actAs:
      Versionable:
        version:         {name: field_name, type: field_type, length: field_length}
        auditLog:        <true | false>
      Timestampable:
        created:
          name:            column_name
          type:            column_type
          format:          date_format
          disabled:        <true | false>
          options:         {notnull: <true | false>}
        updated:
          name:            column_name
          type:            column_type
          format:          date_format
          onInsert:        <true | false>
          disabled:        <true | false>
          options:         {notnull: <true | false>}
      Sluggable:
        name:            slug_column_name
        alias:           slug_column_alias
        type:            slug_column_type
        length:          slug_column_length
        unique:          <true | false>
        fields:          [fieldname1, fieldname2, ...]
        uniqueIndex:     <true | false>
        uniqueBy:        [fieldname1, fieldname2, ...]
        indexName:       index_name
        canUpdate:       <true | false>
        builder:         [class, method]
      I18n:
        fields:          [fieldname1, fieldname2, ...]
        tableName:       translation_table_name
        i18nField:       lang_column_name
        type:            lang_column_type
        length:          lang_column_length
      NestedSet:
        rootColumnName:  root_column_name
        hasManyRoots:    <true | false>
      Searchable:
        fields:          [fieldname1, fieldname2, ...]
        batchUpdates:    <true | false>
      Geographical:
        latitude:
          name:            column_name
          type:            column_type
        longitude:
          name:            column_name
          type:            column_type
      SoftDelete:
        name:            column_name
        type:            column_type
    options:
      type:            <INNODB | MyISAM>
      collate:         collation_name
      charset:         charset_name
      orderBy:         column1 <ASC | DESC>, column2 <ASC | DESC>, ...
      symfony:
        filter:          <true | false>
        form:            <true | false>
    attributes:
      export:             <all | tables | none>
      validate:           <all | lengths | types | none>
      hydrate_overwrite:  <true | false>
      query_class:        class_name
      collection_class:   class_name
      coll_key:           column_name

Global parameters

Doctrine schemas allow you to specify certain parameters that will apply to all of the models defined in the schema file. Below you can find list of global parameters you can set for schema files.

detect_relations

Specifies whether or not to try and detect foreign key relations. This option will attempt to guess relationships based on column names. For example, if you have a User model with a contact_id and a class with the name Contact exists, it will automatically create the relationships between the two. Possible values: <true | false> Default: false

connection

Name of connection to bind the models to. This parameter binds models to a specific connection which is defined in databases.yml file.

package

Package to put the models in. This parameter will generate the models in to sub-folders. With large schema files this will allow you to better organize your schemas in to folders. You can specify more sub folders by doing «package: Folder.Subfolder» and the models would be generated in Folder/Subfolder.

inheritance

Array of inheritance information for models. For details see the «inheritance» parameter defined in the model scope.

actAs

Specifies an array of behaviors for the models to act as. For details see the «actAs» parameter defined in the model scope.

options

Specifies an array of global tables options for the models. When Doctrine creates your tables from your models, these options will be set on the create table statement. For details see the «options» parameter defined in the model scope.

attributes

Specifies the array of attributes for models. Doctrine offers the ability to set attributes for your generated models directly in your schema files similar to how you would if you were manually writing your Doctrine_Record child classes. For details see the «attributes» parameter defined in the model scope.

Model definition

model_name

This is the root section of the model definition and specifies model name.

model_name > connection

Name of connection to bind the model to. This parameter binds model to a specific connection which is defined in databases.yml file.

model_name > tableName

Specifies a database table name. If this option is not defined, then table name is generated using model name.

model_name > className

Specifies a model PHP class name. If this option is not defined, then class name is generated using model name.

model_name > abstract

Specifies whether to make model class as abstract. If this option is set to true, then the abstract modifier is added to the declaration of the model class. Possible values: <true | false> Default: false

model_name > listeners

Specifies an array of listener classes which will be attached to a model.

model_name > package

Specifies the package to put the models in. This parameter will generate the model in to sub-folders. With large schema files this will allow you to better organize your schemas in to folders. You can specify more sub folders by doing «package: Folder.Subfolder» and the models would be generated in Folder/Subfolder.

model_name > package_custom_path

Specifies a custom path to generate the package files to.

Inheritance section

model_name > inheritance

Specifies an array of inheritance information for models.

model_name > inheritance > extends

Specifies model class to extend.

model_name > inheritance > type

Doctrine supports three types of inheritance strategies which can be mixed together:

Possible values: <simple | concrete | column_aggregation>

model_name > inheritance > keyField

This option is used together with column aggregation inheritance and specifies the name of the column, which stores inherited model type value defined in keyValue option. Doctrine automatically adds this column to the create statement of the database table so you do not need to define it in the columns section.

model_name > inheritance > keyValue

This option is used together with column aggregation inheritance and specifies tha value that identifies the inherited model type. This value is stored in the database column specified by the keyField option.

Columns

model_name > columns

Specifies an array of column information for models.

model_name > columns > column_name

The name of this section defines the name for the column in database table and in generated model. This name can be overwritten in tne name attribute.

model_name > columns > column_name > name

Defines the name for the column in database and in generated model. If you want the ability alias a column name as something other than the column name in the database this is easy to accomplish by using the syntax «column_name as field_name» in the name of a column. Eg.:

  Model:
    columns:
      login:
        name: //login as username//
      password:
        ...

The above example would allow you to access the column named login from the alias username..

model_name > columns > column_name > type

Specifies the data type of the column. Possible values: <string | char | boolean | integer | float | decimal | blob | clob | enum | timestamp>

model_name > columns > column_name > length

An integer value that specifies the column length. Some column types depend not only the given portable type but also on the given length. For example type string with length 1000 will be translated into native type TEXT on mysql.

The length is different depending on the type of column you are using:

model_name > columns > column_name > scale

The scale for a decimal column.

model_name > columns > column_name > values

This option is used together with [i]enum[\i] column type and specifies an array of values for the possible enum values.

model_name > columns > column_name > default

Specifies the default value for the column. This value is attached to every newly created Record and when Doctrine creates your database tables it includes the default value in the create table statement.

model_name > columns > column_name > unsigned

Checks if given integer value is unsigned. Default: false

model_name > columns > column_name > unique

Specifies whether the column is a unique key. Unique constraint creates unique index for the column and ensure that the data contained in a column or a group of columns is unique with respect to all the rows in the table. Possible values: <true | false> Default: false

model_name > columns > column_name > primary

Specifies whether the column is a primary key. Possible values: <true | false> Default: false

model_name > columns > column_name > autoincrement

Specifies whether a column is a special identity column in the database that generates a value on insertion of a row. Possible values: <true | false> Default: false

model_name > columns > column_name > comment

Specifies a column comment which is added to the create table statement.

model_name > columns > column_name > notnull

Ensures the 'not null' constraint in both application and database level. A not-null constraint simply specifies that a column must not assume the null value. A not-null constraint is always written as a column constraint. Possible values: <true | false> Default: false

model_name > columns > column_name > email

Checks if value is valid email. The e-mail validator simply validates that the inputted value is indeed a valid e-mail address and that the MX records for the address domain resolve as a valid e-mail address. Possible values: <true | false> Default: false

model_name > columns > column_name > notblank

Checks if value is not blank. The not blank validator is similar to the not null validator except that it will fail on empty strings or strings with white space. Possible values: <true | false> Default: false

model_name > columns > column_name > nospace

Checks that the value doesn't contain any spaces. Possible values: <true | false> Default: false

model_name > columns > column_name > past

The past validator checks if the given value is a valid date in the past. Possible values: <true | false> Default: false

model_name > columns > column_name > future

The future validator checks if the given value is a valid date in the future. Possible values: <true | false> Default: false

model_name > columns > column_name > minlength

Checks that the value string length is equal or greater than the specified minimum length.

model_name > columns > column_name > country

Checks if value is a valid country code. Possible values: <true | false> Default: false

model_name > columns > column_name > ip

Checks if value is valid IP (internet protocol) address. Possible values: <true | false> Default: false

model_name > columns > column_name > htmlcolor

Checks that the given value is a valid html hex color. Possible values: <true | false> Default: false

model_name > columns > column_name > range

Checks if value is within given range of numbers. Used with numeric fields. You can use the range validator to validate max and min values by omitting either one of the 0 or 1 keys of the range array. Below is an example:

  User:
    columns:
      ...
      age:
        type: integer(3)
        range:
          1: 100

model_name > columns > column_name > regexp

Checks if value matches a given regexp.

model_name > columns > column_name > creditcard

Checks whether the string is a well formated credit card number. Possible values: <true | false> Default: false

model_name > columns > column_name > date

Checks if given value is a valid date. Possible values: <true | false> Default: false

model_name > columns > column_name > usstate

Checks if given string is a valid US state code. Possible values: <true | false> Default: false

Relations section

model_name > relations

A hefty part of designing a relational database is dividing the data elements into related tables. Once you're ready to start working with the data, you rely on relationships between the tables to pull the data together in meaningful ways. Relationships between the tables are required to reduce data redundancy and to improve efficiency. When specifying relationships it is only necessary to specify the relationship on the end where the foreign key exists. When the schema file is parsed, it reflects the relationship and builds the opposite end automatically. If you specify the other end of the relationship manually, the auto generation will have no effect.

model_name > relations > relation_name

Specifies the name of the relation. Usualy relation name is the name of the model class this relation is associated to. Otherwise the model class must be specified in the class attribute.

model_name > relations > relation_name > local

The local field of the relation. Local field is the linked field in the defining class.

model_name > relations > relation_name > foreign

The foreign field of the relation. Foreign field is the linked field in the linked class.

model_name > relations > relation_name > type

Specifies the cardinality 'one' or 'many' of the relation. Possible values: <one | many>

model_name > relations > relation_name > class

Specifies the associated model class name.

model_name > relations > relation_name > refClass

The name of the association class. This is only needed for many-to-many associations.

model_name > relations > relation_name > foreignType

Specifies the cardinality 'one' or 'many' of the relation in the foreign class. Possible values: <one | many>

model_name > relations > relation_name > alias

Specifies the relation alias which is used in the model class to refer to associated foreign record collection.

model_name > relations > relation_name > foreignAlias

Specifies the relation alias which is used in the foreign model class to refer to associated record collection.

model_name > relations > relation_name > owningSide

Set this attribute to true to indicate the owning side of the relation. The owning side is the side that owns the foreign key. There can only be one owning side in an association between two classes. Note that this option is required if Doctrine can't guess the owning side or it's guess is wrong. An example where this is the case is when both 'local' and 'foreign' are part of the identifier (primary key). It never hurts to specify the owning side in this way.

model_name > relations > relation_name > equal

Specifies equal nest relation. Used for expressing relations where a class references to itself and the columns within the reference class are equal. This means that when fetching related records it doesn't matter which column in the reference class has the primary key value of the main class. Possible values: <true | false> Default: false

model_name > relations > relation_name > foreignKeyName

When you define a relationship, Doctrine will try to create a foreign key name for you. Sometimes though, this name may not be something you want so you can customize the name to use with this option.

model_name > relations > relation_name > onDelete

The onDelete integrity action that is applied on the foreign key constraint when the tables are created by Doctrine.

The integrity constraints listed above are case sensitive and must be in upper case when being defined in your schema. Possible values: <CASCADE | SET NULL | NO ACTION | RESTRICT | SET DEFAULT>

model_name > relations > relation_name > onUpdate

The onUpdate integrity action that is applied on the foreign key constraint when the tables are created by Doctrine.

The integrity constraints listed above are case sensitive and must be in upper case when being defined in your schema. Possible values: <CASCADE | SET NULL | NO ACTION | RESTRICT | SET DEFAULT>

model_name > relations > relation_name > cascade

This option is used to specify the operations that are cascaded to the related objects on the application-level. Note that the only currently supported value is delete.

Indexes section

model_name > indexes

Indexes are used to find rows with specific column values quickly. Without an index, the database must begin with the first row and then read through the entire table to find the relevant rows.

model_name > indexes > index_name

Defines index name. This name is used to generate index name in the database.

model_name > indexes > index_name > type

Specifies index type. The fulltext index is only supported by MySQL database MyISAM engine. The GiST index is supported by PostgreSQL. Possible values: <unique | fulltext | gist | gin>

model_name > indexes > index_name > fields

Specifies an array of indexed fields.

Checks section

model_name > checks

You can create any kind of CHECK constraints by defining them in this section. Some databases don't support CHECK constraints. When this is the case Doctrine simply skips the creation of check constraints.

model_name > checks > check_name

Specifies the name of the check constraint and the check condition. Check condition can be any valid boolean expression, eg.:

  Product:
    ...
    checks:
      price_check: price > discounted_price

ActAs section

model_name > actAs

This parameter specifies the array of behaviors for the models to act as. When referring to behaviors we refer to class packages that use templates, generators and listeners. These templates are used for adding common definitions and options to record classes. Listeners are used to add Doctrine event based actions.

Versionable behavior

model_name > actAs > Versionable

This template adds version control for table records. Versionable behavior adds an XxxVersion table to store your Xxx model object versions as either only version numbers or version numbers along with ALL column data - to see object data changes through time. If you want this behavior to be configured for you automatically, enter tilde ('~') as a value for this option. Below is an example:

  Model:
    ...
    actAs:
      Versionable:  ~

model_name > actAs > Versionable > version

Defines attributes for version column:

Default: {name: version, type: integer, length: 8}

model_name > actAs > Versionable > auditLog

The auditLog option can be used to turn off the audit log history. This is when you want to maintain a version number but not maintain the data at each version. When auditLog option is set to true, Doctrine creates additional table named {%model_name%_version} which has column structure equal to model column structure and a reference to actual model record. This table is used to maintain the data at each version. Everytime a model object is deleted / updated the previous version is stored into model versions table. Possible values: <true | false> Default: true

Timestampable behavior

model_name > actAs > Timestampable

The Timestampable behavior will automatically add a created_at and updated_at columns and automatically set the values when a record is inserted and updated. If you want this behavior to be configured for you automatically, enter tilde ('~') as a value for this option. Below is an example:

  Model:
    ...
    actAs:
      Timestampable:  ~

'created_at' column options

model_name > actAs > Timestampable > created

Specifies the array of attributes for created_at column.

model_name > actAs > Timestampable > created > name

The name of the created_at column. Default: created_at

model_name > actAs > Timestampable > created > type

The type of the created_at column. Default: timestamp

model_name > actAs > Timestampable > created > format

The format of the timestamp if you don't use the timestamp column type. The date is built using PHP's date() function. Default: Y-m-d H:i:s

model_name > actAs > Timestampable > created > disabled

Specifies whether or not to disable created_at date. When this option is set to true, the created_at column will not be added to the data model. Possible values: <true | false> Default: false

model_name > actAs > Timestampable > created > options

Specifies the additional options for created_at column. Default: {notnull: true}

'updated_at' column options

model_name > actAs > Timestampable > updated

Specifies the array of attributes for updated_at column.

model_name > actAs > Timestampable > updated > name

The name of the updated_at column. Default: updated_at

model_name > actAs > Timestampable > updated > type

The type of the updated_at column. Default: timestamp

model_name > actAs > Timestampable > updated > format

The format of the timestamp if you don't use the timestamp column type. The date is built using PHP's date() function. Default: Y-m-d H:i:s

model_name > actAs > Timestampable > updated > onInsert

Specifies whether or not to add updated_at timestamp when a new record is inserted to database. Possible values: <true | false> Default: true

model_name > actAs > Timestampable > updated > disabled

Specifies whether or not to disable updated_at date. When this option is set to true, the updated_at column will not be added to the data model. Possible values: <true | false> Default: false

model_name > actAs > Timestampable > updated > options

Specifies the additional options for updated_at column. Default: {notnull: true}

Sluggable behavior

model_name > actAs > Sluggable

The Sluggable behavior will automatically add a column to your model for storing a unique human readable identifier that can be created from columns like title, subject, etc. These values can be used for search engine friendly urls.

model_name > actAs > Sluggable > name

The name of the slug column. Default: slug

model_name > actAs > Sluggable > alias

The alias of the slug column.

model_name > actAs > Sluggable > type

The type of the slug column. Default: string

model_name > actAs > Sluggable > length

The length of the slug column. Default: 255

model_name > actAs > Sluggable > unique

This flag will enforce that the slug created is unique. If it is not unique an auto incremented integer will be appended to the slug before saving to database. Possible values: <true | false> Default: true

model_name > actAs > Sluggable > fields

The fields that are used to build slug value.

model_name > actAs > Sluggable > uniqueIndex

Specifies whether or not to create a unique index for slug. This option has effect when the unique option is also set to true. Possible values: <true | false> Default: true

model_name > actAs > Sluggable > uniqueBy

The fields that make determine a unique slug. These fields together with the slug column are included into the unique index.

model_name > actAs > Sluggable > indexName

The name of the index to create.

model_name > actAs > Sluggable > canUpdate

Specifies whether or not the slug can be updated. The canUpdate flag will allow the users to manually set the slug value to be used when building the url friendly slug. Possible values: <true | false> Default: false

model_name > actAs > Sluggable > builder

The Class::method() used to build the slug. Default: [Doctrine_Inflector, urlize]

I18n behavior

model_name > actAs > I18n

I18n is a behavior for Doctrine that provides internationalization support for record classes. Essential when developing a multi-language project.

model_name > actAs > I18n > fields

The fields to internationalize.

model_name > actAs > I18n > tableName

Table name to use for translations table. Default: %TABLE%_translation

model_name > actAs > I18n > i18nField

The name of language column. Default: lang

model_name > actAs > I18n > type

The type of language column. Default: string

model_name > actAs > I18n > length

The length of the language column. Default: 2

NestedSet behavior

model_name > actAs > NestedSet

This behavior allows you to turn your models in to a nested set tree structure where the entire tree structure can be retrieved in one efficient query. It also provides a nice interface for manipulating the data in your trees. If you want this behavior to be configured for you automatically, enter tilde ('~') as a value for this option. Below is an example:

  Model:
    ...
    actAs:
      NestedSet:  ~

model_name > actAs > NestedSet > rootColumnName

The rootColumnName is the column used to differentiate between trees. When you create a new root node you have the option to set the root_id manually, otherwise Doctrine will assign a value for you. Default: root_id

model_name > actAs > NestedSet > hasManyRoots

Specifies whether to allow your table to have multiple root nodes, and therefore multiple trees within the same table. Possible values: <true | false> Default: false

Searchable behavior

model_name > actAs > Searchable

The Searchable behavior is a fulltext indexing and searching tool. It can be used for indexing and searching both database and files.

model_name > actAs > Searchable > fields

Specifies array of searchable fields.

model_name > actAs > Searchable > batchUpdates

If you don't have batch updates enabled then the index will be automatically updated for you when you insert or update searchable records. If you do have batch updates enabled then you can perform the batch updates by invoking the batchUpdateIndex() method in the table class. Possible values: <true | false> Default: false

Geographical behavior

model_name > actAs > Geographical

The Geographical behavior can be used with any data record for determining the number of miles or kilometers between 2 records. Geographical behavior automatically adds the latitude and longitude columns to the records used for calculating distance between two records. If you want this behavior to be configured for you automatically, enter tilde ('~') as a value for this option. Below is an example:

  Model:
    ...
    actAs:
      Geographical:  ~

'latitude' column options

model_name > actAs > Geographical > latitude

Specifies the array of attributes for latitude column.

model_name > actAs > Geographical > latitude > name

The name of the latitude column. Default: latitude

model_name > actAs > Geographical > latitude > type

The type of the latitude column. Default: double

'longitude' column options

model_name > actAs > Geographical > longitude

Specifies the array of attributes for longitude column.

model_name > actAs > Geographical > longitude > name

The name of the longitude column. Default: longitude

model_name > actAs > Geographical > longitude > type

The type of the longitude column. Default: double

SoftDelete behavior

model_name > actAs > SoftDelete

The SoftDelete behavior overrides the delete() functionality and adds a deleted_at column. When delete() is called, instead of deleting the record from the database, a delete_at date is set. If you want this behavior to be configured for you automatically, enter tilde ('~') as a value for this option. Below is an example:

  Model:
    ...
    actAs:
      SoftDelete:  ~

You are required to enable DQL callbacks in order for all executed queries to have the dql callbacks executed on them. In the SoftDelete behavior they are used to filter the select statements to exclude all records where the deleted_at flag is set with an additional WHERE condition. To enable DQL callbacks set use_dql_callbacks attribute to true in the databases.yml file:

  all:
    doctrine:
      ...
      param:
        ...
        attributes:
          use_dql_callbacks: true

model_name > actAs > SoftDelete > name

The name of the deleted_at column. Default: deleted_at

model_name > actAs > SoftDelete > type

The type of the deleted_at column. Default: timestamp

Options section

model_name > options

In this section you can define the array of tables options for the model. When Doctrine creates your table from your model these options will be set on the create table statement. If you add this section, it recalls all attributes which are specified in the global options section. So you have repeatedly define those attributes here.

model_name > options > type

Determines the type of the table engine will be used in the database for current table. Use this attribute for MySQL database. Possible values: <INNODB | MyISAM>

model_name > options > collate

Specifies the collation for the current table (eg. utf8_unicode_ci).

model_name > options > charset

Specifies the character set for the current table (eg. utf8).

model_name > options > orderBy

Specifies «Order By» clause, which is by default added to select queries generated by Doctrine.

Symfony sub-section

model_name > options > symfony

Specifies options which is used by symfony framework.

model_name > options > symfony > filter

Specifies whether or not to generate filter classes. Possible values: <true | false> Default: true

model_name > options > symfony > form

Specifies whether or not to generate form classes. Possible values: <true | false> Default: true

Attributes section

model_name > attributes

This parameter specifies the array of attributes for model. Doctrine offers the ability to set attributes for your generated models directly in your schema files similar to how you would if you were manually writing your Doctrine_Record child classes.

model_name > attributes > export

Specifies what Doctrine should export when exporting classes to your database for creating your tables. Available values:

Possible values: <all | tables | none> Default: all

model_name > attributes > validate

Specifies whether to tests validity of the record using the current data. Available values:

Possible values: <all | lengths | types | none>

model_name > attributes > hydrate_overwrite

Doctrine uses an identity map internally to make sure that multiple objects for one record in a database don't ever exist. If you fetch an object and modify some of its properties, then re-fetch that same object later, the modified properties will be overwritten by default. You can change this behavior for current table by changing the hydrate_overwrite attribute to false. Possible values: <true | false> Default: true

model_name > attributes > query_class

Specifies which query class Doctrine should return whenever you instantiate a new query for current table. The only requirement is that it extends the Doctrine_Query class. Default: Doctrine_Query

model_name > attributes > collection_class

Specifies which collection class Doctrine should use whenever a new collection is instantiated for current table records. The only requirement is that it must extend Doctrine_Collection. Default: Doctrine_Collection

model_name > attributes > coll_key

Specifies column which values will be used as element indexes in collections. By default Doctrine colelction key values are just a sequential numerical indexes. But sometimes you may not want to use normal indexing for collection elements. For example in some cases mapping primary keys as collection keys might be useful. Eg:

  // we assume that coll_key attribute contains 'id' value
  // which is the primary key of a user table
  $users = $userTable->findAll();
  foreach($users as $id => $user) {
      echo $id . $user->username;   // here $id == $user->id
  }