logo
Ask your Symfony questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$10
Doctrine: Call to a member function getFieldName() on a nonobject

I wrote some code to take an XML schema and auto-generate a yaml schema. The XML is an export from a FileMaker Pro database. This is the schema that I was auto-generated by my code:

OldAppellations:
connection: doctrine
tableName: old_appellations
columns:
appellations___sql: { type: text }
appellationsapcode_sql: { type: text }
appellationsappellation_sql: { type: text }
appellationscolor_sql: { type: text }
appellationscountry_sql: { type: text }
appellationsregion_sql: { type: text }
appellationsregion_for_link_sql: { type: text }
appellationssubt_sql: { type: text }
appellationstaster_appel_sql: { type: text }
appellationstotal_r_sql: { type: text }
appellationstype_sql: { type: text }
export_record_id_sql: { type: text }


This is the only yaml in a file called config/doctrine/old_appellations-schema.yml

Then I:

./symfony doctrine:build --model --forms --filters


Then:

 ./symfony doctrine:generate-module tastingnotes old_appellations OldAppellations


Then:

./symfony cc


I point my browser at old_appellations/index.

I get this error:

Notice: Undefined index: o__appellations in /home/lkrubner/dev/tastingnotes/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Hydrator/Graph.php on line 302

Notice: Undefined index: in /home/lkrubner/dev/tastingnotes/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Hydrator/Graph.php on line 303

Fatal error: Call to a member function getFieldName() on a non-object in /home/lkrubner/dev/tastingnotes/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Hydrator/Graph.php on line 304


See screenshot.

Any thoughts?

[UPDATE]

I'm adding a different screenshot, which shows the database table. See the first version of this question if you want to see a screenshot of the error that I got.

This question has been answered.

attachment image asker uploaded image

Lawrence Krubner | 12/08/10 at 10:36pm Edit

Previous versions of this question: 12/08/10 at 10:43pm

(7) Responses

See a threaded view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    12/09/10
    11:31am
    Loban Rahman says:

    Of the top of my head the first thing I'd do is replace that triple underscore column with one. Just in case doctrine got confused. If it then works then you've found a doctrine bug.

  • avatar
    Last edited:
    12/09/10
    4:53am
    José Nahuel Cuesta Luengo says:

    Is this the first build of your model? If not, try removing all the php files in your base doctrine folders (lib/model/doctrine/base at least), and then do your doctrine:build --model --forms --filters.

    Otherwise, it may be some missing space or some indentation problem in your schema file.

  • avatar
    Last edited:
    12/09/10
    10:54am
    Loban Rahman says:

    Jose has a point about stale model files. Use doctrine:clean-model-files. Schema spacing problems would surface while building, not when viewing.

  • avatar
    Last edited:
    12/09/10
    11:18am
    Lawrence Krubner says:

    Good thought. This never seemed to be a problem with Propel, but it definitely came up before with Doctrine. This is my first project working with Doctrine.

  • avatar
    Last edited:
    12/09/10
    11:24am
    Lawrence Krubner says:

    Hmm, no dice. Following the advice of Jose and you, I tried:

    ./symfony doctrine:clean-model-files 

    ./symfony doctrine:build --model --forms --filters

    ./symfony cc


    I deleted everything and started over -- but still the same bug.

  • avatar
    Last edited:
    12/09/10
    11:31am
    Lawrence Krubner says:

    You were right! It was the 3 underscores! I changed the 3 underscores to just 1 underscore so my schema now looks like this:


    OldAppellations:
    connection: doctrine
    tableName: old_appellations
    columns:
    appellations_sql: { type: text }
    appellationsapcode_sql: { type: text }
    appellationsappellation_sql: { type: text }
    appellationscolor_sql: { type: text }
    appellationscountry_sql: { type: text }
    appellationsregion_sql: { type: text }
    appellationsregion_for_link_sql: { type: text }
    appellationssubt_sql: { type: text }
    appellationstaster_appel_sql: { type: text }
    appellationstotal_r_sql: { type: text }
    appellationstype_sql: { type: text }
    export_record_id_sql: { type: text }


    Rebuilt the model and now the error is gone!

  • avatar
    Last edited:
    12/09/10
    11:34am
    José Nahuel Cuesta Luengo says:

    Lawrence, I cannot get your error in a clean project. I copied your schema.yml file and went through your steps but I didn't get any error message. Is there any other "odd" fact about your project?

    I tried it with the latest symfony 1.4. Which version are you using?

This question has expired.





Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.