Symfony 1.2.4: Build-All Bug? Cannot fetch TableMap…


February 19th, 2009

So, I have been recently trying to get back into Symfony. I had taken a break from it for a while to concentrate on Music Review Zone.

I bought a domain recently that I’d like to develop a Symfony application for and since my current knowledge base is with Symfony 1.0 – I thought I’d use it. Then I noticed the benefits of Symfony 1.2.4 and couldn’t pass it up.

So I started creating my project in the usual way:

php symfony init-project <name of project>

php symfony init-app front

I then setup my databases.yml file and completed my schema.yml file. I then ran:

php symfony propel:build-all

… and got the following output:

symfony propel:build-all
>> schema    converting "C:/wamp/vhosts/private/config/schema.yml" to XML
>> schema    putting C:/wamp/vhosts/private/config/generated-schema.xml
>> propel    Running "om" phing task
>> file-     C:/wamp/vhosts/private/config/generated-schema.xml
>> file-     C:/wamp/vhosts/private/co...enerated-schema-transformed.xml
>> autoload  reloading autoloading

  Phing was run before and used many custom classes that might conflict with
  your model classes. In case of errors try running "propel:build-forms" and
  "propel:build-filters" alone. This is due to a PHP limitation that cannot be
  fixed in symfony.

>> propel    generating form classes

  Cannot fetch TableMap for undefined table: location.  Make sure you have the  
static MapBuilder registration code after your peer stub class definition.

[?php

/**
 * User form base class.
 *
 * @package    ##PROJECT_NAME##
 * @subpackage form
 * @author     ##AUTHOR_NAME##
 * @version    SVN: $Id: sfPropelFormGeneratedTemplate.php 12815 2008-11-09 
10:43:58Z fabien $
 */
class BaseUserForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                           => new sfWidgetFormInputHidden(),
      'username'                     => new sfWidgetFormInput(),
      'location_id'                  => new sfWidgetFormPropelChoice(

I am beat as to why this is occurring.

My schema.yml file creates a user and location table, among others. Each user has a location which I state in the YAML as :


user:
    _attributes    { phpName: User }
    id:            ~
    username:      { type: varchar(50), required: true, index: unique }
    location_id:   ~

I also define the location table as:


location:
    _attributes         { phpName: Location }
    id:                 ~
    name:               varchar(50)
    created_at:         ~

So I do not know why ‘symfony propel:build-all ‘ is failing.

When I run each of the commands that makes up the ‘build-all’ option – each succeeds. i.e:

  • build-schema
  • build-sql
  • build-model
  • build-filters
  • build-forms

So is this a bug or are your fresh eyes noticing something that I am missing?

Tags: , ,

Categories: Programming, symfony

7 Responses to “Symfony 1.2.4: Build-All Bug? Cannot fetch TableMap…”

  1. Simon says:

    Have the same problem with symfony 1.2.5 but with tables named “project” and “task”. Maybe those (location included) are reserved for symfony or propel?

  2. I had the same problem with sf 1.2.5. Changed the project table to mc_project didn’t resolved anything.

  3. patrick says:

    hey

    i have the same problem with symfony 1.2.7. i cant find any solution but doing all steps manually.

  4. James says:

    Yeah – this is a real pain in the ass for me.

    It’s so cumbersome having to run the individual commands. Wish they’d fix it already…

  5. Andrew says:

    Found the fix. This is no bug so there won’t be a fix on symfony’s part, I experienced it with 1.4. I also had ‘Project’ and ‘Task’ classes, these must be reserved by symfony. I put a little prefix in front of the table names and ‘phpName’ attributes for each (in my case I used ‘in’), it didn’t work at first, but to complete the fix I removed all the old ‘Project’ and ‘Task’ classes from the lib directory, the most important to remove was ‘ProjectTableMap’ and ‘TaskTableMap’ which I believe were causing all the issues, located in lib/model/map/. I can now run symfony propel:build-all-load without a problem.

  6. Corene Cotelesse says:

    I’m pleased I located this weblog, I couldnt discover any info on this subject matter prior to. I also operate a niche site and if you are ever interested in doing some guest writing for me if possible feel free to let me know, i’m always look for people to check out my blog site. Please stop by and leave a comment sometime!

  7. pestcontrol says:

    Howdy thanks a lot for a critical post, I truly discovered your website by mistake when browsing on Msn for something diffrent closely connected, regardless prior to i ramble on too much i would just like to say how much I cherished your post, I’ve saved your blog and also taken your Feed, Once again thank you very much for the blog post keep up the nice work.

"Thought leadership is how winners are differentiated in business."