How to add custom properties to columns in doctrine 1.2 schema file

138 views Asked by At

I'm working on a symfony 1.4 project which uses Doctrine 1.2. I want to add some custom property for fields inside my schema.yml. The purpose of this is to reuse schema.yml in some other place other than Doctrine, to maintain some meta data about the entity. I tried to add a customproperty as I shown in bellow sample.

TestEntity:
  tableName: test_table
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    name:
      type: string(200)
      customproperty: true

But when I tried to do doctrine build model, now it fails giving the error as follows.

"Invalid schema element named "customproperty" at path "TestEntity->columns->name""

I checked the schema.php file in following location to debug the error.

symfony/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Import/Schema.php

This error comes because the custom property we are specifying is not there in "$_validation" array. Once I added the "customproperty" into that array it stopped giving the error.

But what I did was a hack to doctrine library and is there any other better way to achieve this without touching the library files.

0

There are 0 answers