The "symfony and Doctrine" book, in chapter 4, has a table headed
'data types', which includes inter alia 'char'.
The Doctrine manual, chapter 7, lists column types and does not
include 'char'.

I decided to try Doctrine in a new project, having only used Propel
before. Working from the symfony and Doctrine book, I created my
schema with 'char' throughout.

'symfony doctrine:build-db' and all the related commands accepted
this, and apparently created my (postgres) database successfully. But
as soon as I try to save something I get an exception with the not-
very-useful message "Validation error in class Book ".

Of course I had no idea what this might mean. I went googling and
found some advice about using Doctrine_Exception::getInvalidRecords
and Doctrine_ErrorStack::getRecords. Fortunately I am not a beginner
in symfony, only in Doctrine, so I had a ghost of an idea how I might
use this.

Overriding 'save' to catch the exception and write this stuff to the
logger, I get
  [_errors:protected] => Array
        (
            [nickname] => Array
                (
                    [0] => type
                )

        )

    [_validators:protected] => Array
        (
        )


which told me that no validators had failed, but it didn't like the
column 'nickname'., for some unclear reason.

Eventually I traced through the Doctrine source, and found that
Doctrine_Validator has a hard-coded list of types which does not
include 'char' .(It also does not include 'varchar', 'bit', 'varbit',
or 'inet')

So unless I'm missing something, we have
- a minor bug in Doctrine, whereby the schema parsing can cope with
types that the Validation system throws out
- a more serious bug in Doctrine, where when this happens, it gives an
entirely useless message
- a documentation bug in symfony that turns this minor Doctrine bug
into a showstopper for a novice.

Am I missing something?

(I wondered about versions. I have not found a way to tell what
version of Doctrine I have, but it's whatever came with symfony 1.2.1.
Does the symfony/Doctrine book refer to Doctrine 2 or something?)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to