I have never used "type" refClass tell the class to do the relation n:m and so the local_id and the foreign_id of refClass that make the relation.
not clear maybe .. see my example, it works On Dec 1, 2:38 am, Haris Zukanović <[email protected]> wrote: > Hi, > I have generated doctrine schema.yml with "doctrine:build-schema" from > my existing innoDB database but I can not see all the parameters which > you say define well a many to many relation > A many to many looks like this in my schema.yml: > > relations: > InstallationUsesServer: > local: id > foreign: installation_id > type: many > > it seems to be missing "refClass" and it has the "type" param > > Do I have a misconfigured config files for the task doctrine:build-schema? > Also, "doctrine:build-forms" seems to add widgets only for table columns > skipping adding widgets for relations. I suppose that is because of the > missing "refClass" in my schema.yml ? > > Thanx > Haris > > Antoine S. wrote: > > Hi > > You don't need to define in the generator.yml the type doublelist. > > If you model is ok, > > the form will have a widget : tags_list (widget select many) > > > example of schema.yml n:m to have a widget categories_list in the > > ProductForm : > > Category: > > columns: > > id: > > type: integer(4) > > primary: true > > notnull: true > > autoincrement: true > > name: > > type: string(45) > > notnull: true > > Product: > > columns: > > id: > > type: integer(4) > > primary: true > > notnull: true > > autoincrement: true > > name: > > type: string(45) > > notnull: true > > relations: > > categories: > > class: Category > > local: Product_id > > foreign: Category_id > > refClass: CategoryProduct > > foreignAlias: Products > > > CategoryProduct: > > columns: > > Category_id: > > type: integer(4) > > primary: true > > notnull: true > > Product_id: > > type: integer(4) > > primary: true > > notnull: true > > relations: > > Category: > > local: Category_id > > foreign: id > > foreignAlias: CategoryProduct > > Product: > > local: Product_id > > foreign: id > > foreignAlias: CategoryProduct > > options: > > type: InnoDB > > > On Nov 30, 12:21 pm, Greg Romanssen <[email protected]> wrote: > > >> Hello, > > >> trying to learn how to use doctrine_admin_double_list that is listed > >> inhttp://www.symfony-project.org/book/1_2/14-Generators > > >> I created schema.yml with tables Tag, BlogPost, BlogPostTag and created > >> admin. > >> M:N works well but I would like that nice admin_double_list. > > >> I edited generator.yml of blogpost module to this: > > >> generator: > >> class: sfDoctrineGenerator > >> param: > >> model_class: BlogPost > >> theme: admin > >> non_verbose_templates: true > >> with_show: false > >> singular: BlogPost > >> plural: BlogPosts > >> route_prefix: blog_post > >> with_doctrine_route: true > >> actions_base_class: sfActions > > >> config: > >> actions: ~ > >> fields: ~ > >> list: ~ > >> filter: ~ > >> form: ~ > >> edit: > >> title: Editace > >> fields: > >> BlogPostTag: > >> name: Tagy > >> type: doctrine_admin_double_list > >> display: > >> [BlogPostTag] > >> new: ~ > > >> Unfortunately site reports this: > > >> 500 | Internal Server Error | InvalidArgumentException > > >> Widget "BlogPostTag" does not exist. > > >> stack trace > > >> * at **() > >> in /SF_ROOT_DIR\lib\vendor\symfony\lib\form\sfForm.class.php/ line > >> 1049 ... > >> <http://symfony.amslocal.com/backend_dev.php/blogpost/1/edit#> > >> 1046. { > >> 1047. if (!$widget = $this->widgetSchema[$name]) > >> 1048. { > >> 1049. throw new > >> InvalidArgumentException(sprintf('Widget "%s" does not exist.', $name)); > >> 1050. } > >> 1051. > > >> 1052. if ($this->isBound) > >> * at *sfForm->offsetGet*('BlogPostTag') > >> in > >> > >> /SF_ROOT_DIR\cache\backend\dev\modules\autoBlogpost\templates\_form_field.php/ > >> line 6 ... > >> <http://symfony.amslocal.com/backend_dev.php/blogpost/1/edit#> > >> 3. <?php elseif ($field->isComponent()): ?> > >> 4. <?php include_component('blogpost', $name, > >> array('form' => $form, 'attributes' => $attributes instanceof > >> sfOutputEscaper ? $attributes->getRawValue() : $attributes)) ?> > >> 5. <?php else: ?> > >> 6. <div class="<?php echo $class ?><?php > >> $form[$name]->hasError() and print ' errors' ?>"> > >> 7. <?php echo $form[$name]->renderError() ?> > >> 8. <div> > >> 9. <?php echo $form[$name]->renderLabel($label) ?> > >> * at > >> > >> *require*('C:\work\www\symfony\cache\backend\dev\modules\autoBlogpost\templates\_form_field.php') > >> in /SF_ROOT_DIR\lib\vendor\symfony\lib\view\sfPHPView.class.php/ > >> line 72 ... > >> <http://symfony.amslocal.com/backend_dev.php/blogpost/1/edit#> > >> 69. // render > >> 70. ob_start(); > >> 71. ob_implicit_flush(0); > >> 72. require($_sfFile); > >> 73. > > >> 74. return ob_get_clean(); > >> 75. } > >> * at > >> > >> *sfPHPView->renderFile*('C:\work\www\symfony\cache\backend\dev\modules/autoBlogpost/templates/_form_field.php') > >> in > >> /SF_ROOT_DIR\lib\vendor\symfony\lib\view\sfPartialView.class.php/ > >> line 110 ... > >> <http://symfony.amslocal.com/backend_dev.php/blogpost/1/edit#> > >> 107. $this->getAttributeHolder()->set('sf_type', > >> 'partial'); > >> 108. > > >> 109. // render template > >> 110. $retval = > >> $this->renderFile($this->getDirectory().'/'.$this->getTemplate()); > >> 111. } > >> 112. catch (Exception $e) > >> 113. { > >> * at *sfPartialView->render*() > >> in /SF_ROOT_DIR\lib\vendor\symfony\lib\helper\PartialHelper.php/ > >> line 218 ... > >> <http://symfony.amslocal.com/backend_dev.php/blogpost/1/edit#> > >> 215. $view = new $class($context, $moduleName, $actionName, > >> ''); > >> 216. $view->setPartialVars($vars); > >> 217. > > >> 218. return $view->render(); > >> 219. } > >> 220. > > >> 221. /** > >> * at *get_partial*('blogpost/form_field', /array/('name' => > >> 'BlogPostTag', 'attributes' => > >> /object/('sfOutputEscaperArrayDecorator'), 'label' => /null/, > >> 'help' => /null/, 'form' => /object/('BlogPostForm'), 'field' => > >> /object/('sfOutputEscaperObjectDecorator'), 'class' => > >> 'sf_admin_form_row sf_admin_text sf_admin_form_field_BlogPostTag')) > >> in /SF_ROOT_DIR\lib\vendor\symfony\lib\helper\PartialHelper.php/ > >> line 180 ... > >> <http://symfony.amslocal.com/backend_dev.php/blogpost/1/edit#> > >> 177. */ > >> 178. function include_partial($templateName, $vars = array()) > >> 179. { > >> 180. echo get_partial($templateName, $vars); > >> 181. } > >> 182. > > >> 183. /** > >> * at *include_partial*('blogpost/form_field', /array/('name' => > >> 'BlogPostTag', 'attributes' => > >> /object/('sfOutputEscaperArrayDecorator'), 'label' => /null/, > >> 'help' => /null/, 'form' => /object/('BlogPostForm'), 'field' => > >> /object/('sfOutputEscaperObjectDecorator'), 'class' => > >> 'sf_admin_form_row sf_admin_text sf_admin_form_field_BlogPostTag')) > >> in > >> > >> /SF_ROOT_DIR\cache\backend\dev\modules\autoBlogpost\templates\_form_fieldset.php/ > >> line 16 ... > >> <http://symfony.amslocal.com/backend_dev.php/blogpost/1/edit#> > >> 13. 'form' => $form, > >> 14. 'field' => $field, > >> 15. 'class' => 'sf_admin_form_row > >> sf_admin_'.strtolower($field->getType()).' sf_admin_form_field_'.$name, > >> 16. )) ?> > >> 17. <?php endforeach; ?> > >> 18. </fieldset> > >> 19. > > >> * at > >> > >> *require*('C:\work\www\symfony\cache\backend\dev\modules\autoBlogpost\templates\_form_fieldset.php') > >> in /SF_ROOT_DIR\lib\vendor\symfony\lib\view\sfPHPView.class.php/ > >> line 72 ... > >> <http://symfony.amslocal.com/backend_dev.php/blogpost/1/edit#> > >> 69. // render > >> 70. ob_start(); > >> 71. ob_implicit_flush(0); > >> 72. require($_sfFile); > >> 73. > > >> 74. return ob_get_clean(); > >> 75. } > >> * at > >> > >> *sfPHPView->renderFile*('C:\work\www\symfony\cache\backend\dev\modules/autoBlogpost/templates/_form_fieldset.php') > >> in > >> /SF_ROOT_DIR\lib\vendor\symfony\lib\view\sfPartialView.class.php/ > >> line 110 ... > >> <http://symfony.amslocal.com/backend_dev.php/blogpost/1/edit#> > >> 107. $this->getAttributeHolder()->set('sf_type', > >> 'partial'); > >> 108. > > >> 109. // render template > >> 110. $retval = > >> $this->renderFile($this->getDirectory().'/'.$this->getTemplate()); > >> 111. } > >> 112. catch (Exception $e) > >> 113. { > >> * at *sfPartialView->render*() > >> in /SF_ROOT_DIR\lib\vendor\symfony\lib\helper\PartialHelper.php/ > >> line 218 ... > >> <http://symfony.amslocal.com/backend_dev.php/blogpost/1/edit#> > >> 215. $view = new $class($context, $moduleName, $actionName, > >> ''); > >> 216. $view->setPartialVars($vars); > >> 217. > > ... > > read more » > > softing_logo.png > 7KViewDownload -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.
