Hi Dennis,

thank you for your comments.

About your problem adding a Children to the Parent Object, i don't
understand it very well.

I just take a look to your link about but i think it's more or less
like im doing? Adding some embeds , right?

Can you explain me more?

Thank you.



On 7 oct, 01:24, Dennis <gear...@sbcglobal.net> wrote:
> Try this for adding an object's PARENT form to the child 
> form.http://www.symfony-project.org/blog/2008/11/07/new-in-symfony-1-2-doc...
>
> Where it says "Edit/Add Author" Exactly in the middle of the document.
>
> Me, I'm looking to add Chidren to the Parent Object, but not a large
> quanity of them like this guy 
> did:http://www.thatsquality.com/articles/can-the-symfony-forms-framework-...
>
> Also, he had to go to a lot of trouble to get it to work.
>
> There's got to be a way to add the children, or a blank one without
> going to the trouble that he went tol.
>
> (doctrine btw)
> ParticularForm extends BaseParticularForm{
>
> function configuration(){
>   $this->getObject()->getRelatedObjectForm
>
> On Oct 5, 11:20 pm, Francisco José Núñez Rivera <elfra...@gmail.com>
> wrote:
>
> > I tried it with
>
> > $opinion = new Opinion();
> > $opfeat = new $opinion->OpinionFeature;
>
> > but cant find the class OpinionFeature...
>
> > Otherwise i do the same you write (more or less). I think that when i'm
> > showing opinion form it creates a new Opinion(); variable.
> > Then i use that variable to set the new OpinionFeature var...
> > $opfeat->setOpinionId($this->getObject()->id);
> > $opfeat->setFeatureId($feature->getId());
>
> > $OFform = new OpinionFeatureForm($opfeat);
> > $this->embedForm('feature_'.$feature->getId(), $OFform);
>
> > But it doesnt work... i have to overwrite saveEmbedForms....
>
> > public function saveEmbeddedForms($con = null, $forms = null)
> >   {
>
> >         foreach($this->getEmbeddedForms() as $opinionForm)
> >         {
>
> > $opinionForm->getObject()->setOpinionId($this->getObject()->getId());
> >         }
>
> >     parent::saveEmbeddedForms($con, $forms);
> >   }
>
> > I think there's a easier way to do this but.. i dont know. :(
>
> > 2009/10/6 Dennis <gear...@sbcglobal.net>
>
> > > I got this off of a Fabien post, somewhere. If you look at it, it
> > > makes everything connect to the same parent record. It SHOULD save
> > > correctly. I am goin to try it in my project tonight. Let me know if
> > > it works for you.
>
> > > $user = new User();
> > > $profile = new $user->Profile;
> > > $userForm = new UserForm($user);
> > > $profileForm = new ProfileForm($profile);
> > > $userForm->embedForm('Profile', $profileForm);
>
> > > On Oct 5, 2:13 am, elkrema <elfra...@gmail.com> wrote:
> > > > Hi Dennis,
>
> > > > there is my schema:
>
> > > > Feature:
> > > >   tableName: feature
> > > >   columns:
> > > >     id:
> > > >       type: integer(8)
> > > >       primary: true
> > > >       autoincrement: true
> > > >     name:
> > > >       type: string(255)
> > > >       notnull: true
> > > >     created_at: timestamp(25)
> > > >     updated_at: timestamp(25)
> > > >   relations:
> > > >     OpinionFeature:
> > > >       local: id
> > > >       foreign: feature_id
> > > >       type: many
>
> > > > Opinion:
> > > >   tableName: opinion
> > > >   columns:
> > > >     id:
> > > >       type: integer(8)
> > > >       primary: true
> > > >       autoincrement: true
> > > >     title:
> > > >       type: string(255)
> > > >       notnull: true
> > > >     opiniontxt:
> > > >       type: string(2147483647)
> > > >       notnull: true
> > > >     is_active:
> > > >       type: integer(1)
> > > >       default: '0'
> > > >       notnull: true
> > > >     token:
> > > >       type: string(255)
> > > >       notnull: true
> > > >     created_at: timestamp(25)
> > > >     updated_at: timestamp(25)
> > > >   relations:
> > > >     OpinionFeature:
> > > >       local: id
> > > >       foreign: opinion_id
> > > >       type: many
>
> > > > OpinionFeature:
> > > >   tableName: opinion_feature
> > > >   columns:
> > > >     opinion_id:
> > > >       type: integer(8)
> > > >       primary: true
> > > >     feature_id:
> > > >       type: integer(8)
> > > >       primary: true
> > > >     score:
> > > >       type: float(2147483647)
> > > >       notnull: true
> > > >     created_at: timestamp(25)
> > > >     updated_at: timestamp(25)
> > > >   relations:
> > > >     Opinion:
> > > >       local: opinion_id
> > > >       foreign: id
> > > >       type: one
> > > >     Feature:
> > > >       local: feature_id
> > > >       foreign: id
> > > >       type: one
>
> > > > Its very similar to your schema. Mine havent got foreign_type but i
> > > > think it works same yours... no?
>
> > > > I did that with mysql workbench and then build schema... :)
>
> > > > I think the problem was save embed forms i have to overwrite the
> > > > saveEmbedForms function to set the opinionid of the OpinionFeature
> > > > just at the moment of insert the opinion. Doing that it works, but i
> > > > dont know if its the right way.
>
> > > > Thank you very much.
>
> > > > On 5 oct, 05:10, Dennis <gear...@sbcglobal.net> wrote:
>
> > > > > So what you have is a:
>
> > > > > <Opinion>--1-to-many --<OpinionFeature>--many-to-1--<Feature>
>
> > > > > (above is a good way to show a schema)
>
> > > > > So you have to set up your schema to reflect that:
>
> > > > > Keep in mind that you have to create the Parents, before creating the
> > > > > children.
> > > > > Parents HAVE an ID, Children are GIVEN or USE and ID.
>
> > > > > Parents are 'Opinion' and 'Feature'.
>
> > > > > Opinion:
> > > > >   tableName: opinion
> > > > >   columns:
> > > > >     opinion_id:
> > > > >       type: integer(8)
> > > > >       primary: true
> > > > >       sequence: opinion_opinion_id
> > > > >     opinion_name:
> > > > >       type: string(65)
> > > > >       notnull: true
> > > > >   relations:
> > > > >     OpinionFeature:
> > > > >       local: opinion_id
> > > > >       foreign: opinion_id
> > > > >       type: many
> > > > >       foreignType: one
>
> > > > > Feature:
> > > > >   tableName: feature
> > > > >   columns:
> > > > >     feature_id:
> > > > >       type: integer(8)
> > > > >       primary: true
> > > > >       sequence: feature_feature_id
> > > > >     feature_name:
> > > > >       type: string(32)
> > > > >       notnull: true
> > > > >     feature_desc:
> > > > >       type: string(128)
> > > > >       notnull: true
> > > > >   relations:
> > > > >     OpinionFeature:
> > > > >       local: feature_id
> > > > >       foreign: feature_id
> > > > >       type: many
> > > > >       foreignType: one
>
> > > > > OpinionFeature:
> > > > >   tableName: opinionfeature
> > > > >   columns:
> > > > >     opinion_id:
> > > > >       type: integer(8)
> > > > >       primary: true
> > > > >     feature_id:
> > > > >       type: integer(8)
> > > > >       primary: true
> > > > >     score:
> > > > >       type: integer(2)
> > > > >       notnull: true
> > > > >   relations:
> > > > >     Opinion:
> > > > >       local: opinion_id
> > > > >       foreign: opinion_id
> > > > >       type: one
> > > > >       foreignType: many
> > > > >     Feature:
> > > > >       local: feature_id
> > > > >       foreign: feature_id
> > > > >       type: one
> > > > >       foreignType: many
>
> > > > >  See if this works :-)
>
> > > > > Personally, I like graphical database design tools. I make the design,
> > > > > have it spit out the code for the database that I'm using, then make
> > > > > the database, use Doctrine to build the schema (instead of composing
> > > > > it like above), make my model-forms-filters, and go.
>
> > > > > I've had good luck using DezignForDatabases. The guy who makes it is
> > > > > very helpful and friendly. It's not perfect, but it's great for the
> > > > > price.
> > > > > On Oct 2, 3:39 am, Francisco José Núñez Rivera <elfra...@gmail.com>
> > > > > wrote:
>
> > > > > > But all the opinions have the same features.
>
> > > > > > Feature -> id , desc
> > > > > > 1,Feature 1 ; 2, Feature2...
>
> > > > > > Opinion shows all the features..
> > > > > > Feature 1 -Score:
> > > > > > Feature 2 - Score:
>
> > > > > > OpinionFeature -> opinion_id , feature_id , score
> > > > > > I only insert a row here when im scoring a feature.
>
> > > > > > I think my schema is right... no?
>
> > > > > > Thank you very much.
>
> > > > > > 2009/10/1 Abraham Montilla <amontil...@gmail.com>
>
> > > > > > > elkrema, if you have I have an Opinion with many Features then the
> > > right
> > > > > > > schema is
>
> > > > > > > Feature is: id, opinion_id, desc
> > > > > > > OpinionFeature is: opinion_id, score
>
> > > > > > > that's why you have an integrity constraint violation.... I don't
> > > know how
> > > > > > > i missed that first time i read your post hehe, that's all the
> > > problem
>
> > > > > > > 2009/10/1 elkrema <elfra...@gmail.com>
>
> > > > > > >> With unsetting only option id doesn't work.
>
> > > > > > >> The problem is that i am inserting the object of main form and 
> > > > > > >> the
> > > > > > >> embedded objects too.
>
> > > > > > >> But i found a solution... I rewrite the function 
> > > > > > >> saveEmbeddedForms
> > > in
> > > > > > >> OpinionForm
>
> > > > > > >>  public function saveEmbeddedForms($con = null, $forms = null)
> > > > > > >>  {
>
> > > > > > >>                foreach($this->getEmbeddedForms() as $opinionForm)
> > > > > > >>                {
>
> > > > > > >>  $opinionForm->getObject()->setOpinionId($this->getObject()->getId
> > > > > > >> ());
> > > > > > >>                }
>
> > > > > > >>        parent::saveEmbeddedForms($con, $forms);
> > > > > > >>  }
>
> > > > > > >> I set the opinionid before saving the embed forms....I dont know
> > > if is
> > > > > > >> the good way..
>
> > > > > > >> Otherwise i have a new problem..
>
> > > > > > >> when i'm editing an opinion the value of the last feature is not
> > > > > > >> showed.. ¿?
>
> > > > > > >> Thank you!
>
> > > > > > >> On 30 sep, 07:21, Abraham Montilla <amontil...@gmail.com> wrote:
> > > > > > >> > try just unsetting opinion_id, tell me if works
>
> > > > > > >> > 2009/9/29 elkrema
>
> ...
>
> leer más »
--~--~---------~--~----~------------~-------~--~----~
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