Well, you still didn't tell me if you're using symfony 1.3/1.4 because then you
won't need this anymore.
And this seems just wrong what you're doing: you're defining the sfGuardUser
relation on the PanelUser model but embed the PanelUser into the sfGuardUser
AND then extend the sfGuardUserForm. Man, too complex and illogical. I know
these relations are said to be bidirectional but you're also not defining the
relation PanelUser->sfGuardUser as a one-to-one relation explicitly.
For symfony 1.3/1.4 define your schema this way (in
project/config/doctrine/schema.yml):
sfGuardUser:
columns:
first_name: string(255)
last_name: string(255)
email_address: string(255)
Then do a ./symfony doctrine:build --all (add --and-load if you need to load
fixtures).
That should be it. No need for a new model just to add columns to the user
model, symfony 1.3/1.4 automatically merges all schemas (plugin and project) on
build.
Post back here if you're using symfony 1.2.
Cheers, Daniel
On Jan 6, 2010, at 1:22 PM, kierzniak wrote:
> No, i embed panel_user_form to sf_guard_user_form. This is my schema
> for PanelUser model. And SfGuardUser have own schema from plugin.
> http://pastie.org/768676
>
> And this is my class PanelUserRegisterForm witch is extended by
> SfGuardUserForm
> http://pastie.org/768680
>
> When i remove the method saveEmbeddedForms i have three inserts to
> database.
> Thanks!!!
>
> On 5 Sty, 21:39, Daniel Lohse <[email protected]> wrote:
>> I don't understand this. Do you embed the same form into the same form?
>>
>> I'd need to see your schema and the form code where you're embedding the
>> additional form.
>>
>> Cheers, Daniel
>>
>> On Jan 5, 2010, at 4:11 PM, kierzniak wrote:
>>
>>> I have read many of theese tutorials. Without effect. I have unset id.
>>> But.. look at this schema of saving forms
>>> http://vousavezchoisi.com/img/formsdiagram.png
>>> I don't know if is correct but according to this image my form is
>>> saving twice to the database. First in doSave() method and second in
>>> saveEmbededForms() method. I think that here is the problem. When i
>>> try to overwrite the saveEmbededForms() only by return null:
>>> everything seams to be allright. But c'mon! This can't correct way to
>>> save form.
>>
>>> On 5 Sty, 07:44, Daniel Lohse <[email protected]> wrote:
>>>> What symfony/Doctrine version are you using? If it's 1.3/1.4, you can
>>>> use embedRelation().
>>
>>>> Over the top of my head, I'd guess it's got something to do with you
>>>> not unset()-ing the primary key of the embedded form. There was even a
>>>> blog post from Fabien (I think) about this, so search Google for that.
>>
>>>> Cheers, Daniel
>>
>>>> Sent from my iPhone
>>
>>>> On Jan 5, 2010, at 2:36 AM, kierzniak <[email protected]> wrote:
>>
>>>>> I have problem during saving embed form. Someone describe it on this
>>>>> site:
>>>>> http://symfonyguide.wordpress.com/2009/09/28/symfony-forms-saving-pro...
>>>>> my problem is connected with this part:
>>
>>>>> "I tried to embed an sfGuardForm with this system. Saving a new object
>>>>> went fine, but for some reasons, editing didn’t work. After some a l
>>>>> ot
>>>>> of debug, I found that it triggered a hidden validation error “An
>>>>> object with the same ‘username’ already exists”. Honestly I don
>>>>> ’t
>>>>> really remember on which level it happened, but I think this is linked
>>>>> to the fact that some methods are executed twice and shouldn’t be.
>>>>> Even calling the bind() method on embedded forms seems to me to be a
>>>>> redundancy. When you submit a form, doClean() deeply clean the values,
>>>>> meaning even embedded forms values are passed to the validators, and
>>>>> returned cleaned. So if you call bind() on an embedded form it will
>>>>> call the clean method again."
>>
>>>>> In my case when i try to save embed form i have three "inserts" to
>>>>> database while should be only 2. One to sfGuardUser table and one to
>>>>> my schema table PanelUser. Insert to PanelUser is doubled and i don't
>>>>> know why.
>>
>>>>> INSERT INTO sf_guard_user (algorithm, is_active, is_super_admin,
>>>>> username, salt, password, created_at, updated_at) VALUES
>>>>> (?, ?, ?, ?, ?, ?, ?, ?) - (sha1, 1, 0, pio.ma,
>>>>> e4ebecdd99d5f1128e87b36980fcb89b,
>>>>> 1744b44ee23963ecf737b33839e464b1bcb0af90, 2009-12-31 15:21:14,
>>>>> 2009-12-31 15:21:14)
>>
>>>>> INSERT INTO panel_user (sf_guard_user_id, first_name, last_name,
>>>>> email_address, allegro_id) VALUES (?, ?, ?, ?, ?) - (6, Piotr, Malek,
>>>>> [email protected], 12313123)
>>
>>>>> INSERT INTO panel_user (first_name, last_name, email_address,
>>>>> allegro_id) VALUES (?, ?, ?, ?) - (Piotr, Malek, [email protected],
>>>>> 12313123)
>>
>>>>> --
>>
>>>>> 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
>>>>> athttp://groups.google.com/group/symfony-users?hl=en
>>>>> .
>>
>>> --
>>
>>> 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
>>> athttp://groups.google.com/group/symfony-users?hl=en.
> --
> 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.
>
>
--
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.