<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to Embed Forms in Symfony 1.2 Admin Generator Part 2</title>
	<atom:link href="http://sandbox-ws.com/frameworks/symfony-frameworks/how-to-embed-forms-in-symfony-12-admin-generator-part-2/feed" rel="self" type="application/rss+xml" />
	<link>http://sandbox-ws.com/frameworks/symfony-frameworks/how-to-embed-forms-in-symfony-12-admin-generator-part-2</link>
	<description>Personal Blog of Ahmed El.Hussaini</description>
	<lastBuildDate>Tue, 31 Aug 2010 17:11:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: milon</title>
		<link>http://sandbox-ws.com/frameworks/symfony-frameworks/how-to-embed-forms-in-symfony-12-admin-generator-part-2/comment-page-2#comment-6361</link>
		<dc:creator>milon</dc:creator>
		<pubDate>Sat, 28 Aug 2010 13:12:06 +0000</pubDate>
		<guid isPermaLink="false">http://sandbox-ws.com/?p=261#comment-6361</guid>
		<description>thanks for your post..
i have follow your descriptions . see my Schema and form class definition .   


TestQuestion:
  actAs:              [ Timestampable,DmSortable ]
  columns:
    name:             { type: string(200), notnull: true}
    is_active:        { type: boolean, notnull: true, default: false }


AnswerOption:
  actAs:              [ Timestampable,DmSortable ]
  columns:
    test_id:          { type: integer, notnull: true}
    options:          { type: string(255), notnull: true }
  relations:
     TestQuestion:
       class: TestQuestion
       onDelete: CASCADE
       local: test_id
       foreign: id
       foreignAlias: AnswerOptions
            foreach ($this-&gt;getObject()-&gt; getAnswerOptions()  as $answerOption) {

                // create a new subcategory form for the current subcategory model object
                $answerOption_form = new AnswerOptionForm($answerOption);

                // embed the subcategory form in the main category form
                $this-&gt;embedForm(&#039;AnswerOption&#039;.$answerOption-&gt;getId(), $answerOption_form);

                // set a custom label for the embedded form
                $this-&gt;widgetSchema[&#039;answerOption&#039;.$answerOption-&gt;getId()]-&gt;setLabel(&#039;Subcategory: &#039;.$answerOption-&gt;getOptions());

                // change the name widget to sfWidgetFormInputDelete
//                $this-&gt;widgetSchema[&#039;subcategory&#039;.$subcategory-&gt;getId()][&#039;name&#039;] = new sfWidgetFormInputDelete(array(
//                                &#039;url&#039; =&gt; &#039;category/deleteSubcategory&#039;,      // required
//                                &#039;model_id&#039; =&gt; $subcategory-&gt;getId(),        // required
//                                &#039;confirm&#039; =&gt; &#039;Sure???&#039;,                     // optional
//                ));

            }

            // create a new subcategory form for a new subcategory model object
            $answerOption_form = new AnswerOptionForm();

            // embed the subcategory form in the main category form
            $this-&gt;embedForm(&#039;answerOption&#039;, $answerOption_form);

            // set a custom label for the embedded form
            $this-&gt;widgetSchema[&#039;answerOption&#039;]-&gt;setLabel(&#039;New answerOption&#039;);

        }



class AnswerOptionForm extends BaseAnswerOptionForm
{
  public function configure()
  {
       unset($this[&#039;created_at&#039;], $this[&#039;updated_at&#039;], $this[&#039;test_id&#039;], $this[&#039;position&#039;]);

  }
}

input field load successfully but when i try to add data its shown the following  error 

&quot;
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`learning`.`answer_option`, CONSTRAINT `answer_option_test_id_test_question_id` FOREIGN KEY (`test_id`) REFERENCES `test_question` (`id`) ON DELETE CASCADE)
&quot;

plz any one who can help me for solving this problem?

thank advance</description>
		<content:encoded><![CDATA[<p>thanks for your post..<br />
i have follow your descriptions . see my Schema and form class definition .   </p>
<p>TestQuestion:<br />
  actAs:              [ Timestampable,DmSortable ]<br />
  columns:<br />
    name:             { type: string(200), notnull: true}<br />
    is_active:        { type: boolean, notnull: true, default: false }</p>
<p>AnswerOption:<br />
  actAs:              [ Timestampable,DmSortable ]<br />
  columns:<br />
    test_id:          { type: integer, notnull: true}<br />
    options:          { type: string(255), notnull: true }<br />
  relations:<br />
     TestQuestion:<br />
       class: TestQuestion<br />
       onDelete: CASCADE<br />
       local: test_id<br />
       foreign: id<br />
       foreignAlias: AnswerOptions<br />
            foreach ($this->getObject()-> getAnswerOptions()  as $answerOption) {</p>
<p>                // create a new subcategory form for the current subcategory model object<br />
                $answerOption_form = new AnswerOptionForm($answerOption);</p>
<p>                // embed the subcategory form in the main category form<br />
                $this->embedForm(&#8216;AnswerOption&#8217;.$answerOption->getId(), $answerOption_form);</p>
<p>                // set a custom label for the embedded form<br />
                $this->widgetSchema['answerOption'.$answerOption->getId()]->setLabel(&#8216;Subcategory: &#8216;.$answerOption->getOptions());</p>
<p>                // change the name widget to sfWidgetFormInputDelete<br />
//                $this->widgetSchema['subcategory'.$subcategory->getId()]['name'] = new sfWidgetFormInputDelete(array(<br />
//                                &#8216;url&#8217; => &#8216;category/deleteSubcategory&#8217;,      // required<br />
//                                &#8216;model_id&#8217; => $subcategory->getId(),        // required<br />
//                                &#8216;confirm&#8217; => &#8216;Sure???&#8217;,                     // optional<br />
//                ));</p>
<p>            }</p>
<p>            // create a new subcategory form for a new subcategory model object<br />
            $answerOption_form = new AnswerOptionForm();</p>
<p>            // embed the subcategory form in the main category form<br />
            $this->embedForm(&#8216;answerOption&#8217;, $answerOption_form);</p>
<p>            // set a custom label for the embedded form<br />
            $this->widgetSchema['answerOption']->setLabel(&#8216;New answerOption&#8217;);</p>
<p>        }</p>
<p>class AnswerOptionForm extends BaseAnswerOptionForm<br />
{<br />
  public function configure()<br />
  {<br />
       unset($this['created_at'], $this['updated_at'], $this['test_id'], $this['position']);</p>
<p>  }<br />
}</p>
<p>input field load successfully but when i try to add data its shown the following  error </p>
<p>&#8221;<br />
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`learning`.`answer_option`, CONSTRAINT `answer_option_test_id_test_question_id` FOREIGN KEY (`test_id`) REFERENCES `test_question` (`id`) ON DELETE CASCADE)<br />
&#8221;</p>
<p>plz any one who can help me for solving this problem?</p>
<p>thank advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: milon</title>
		<link>http://sandbox-ws.com/frameworks/symfony-frameworks/how-to-embed-forms-in-symfony-12-admin-generator-part-2/comment-page-2#comment-6360</link>
		<dc:creator>milon</dc:creator>
		<pubDate>Sat, 28 Aug 2010 10:10:41 +0000</pubDate>
		<guid isPermaLink="false">http://sandbox-ws.com/?p=261#comment-6360</guid>
		<description>Excellent post, thank you so much …
but i need for admin panel</description>
		<content:encoded><![CDATA[<p>Excellent post, thank you so much …<br />
but i need for admin panel</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alan</title>
		<link>http://sandbox-ws.com/frameworks/symfony-frameworks/how-to-embed-forms-in-symfony-12-admin-generator-part-2/comment-page-2#comment-6352</link>
		<dc:creator>Alan</dc:creator>
		<pubDate>Sat, 14 Aug 2010 05:24:48 +0000</pubDate>
		<guid isPermaLink="false">http://sandbox-ws.com/?p=261#comment-6352</guid>
		<description>Excelent post, thank you so much ...
you solved my problems, 2 1/2 days of work!</description>
		<content:encoded><![CDATA[<p>Excelent post, thank you so much &#8230;<br />
you solved my problems, 2 1/2 days of work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ahmed El.Hussaini</title>
		<link>http://sandbox-ws.com/frameworks/symfony-frameworks/how-to-embed-forms-in-symfony-12-admin-generator-part-2/comment-page-2#comment-6351</link>
		<dc:creator>Ahmed El.Hussaini</dc:creator>
		<pubDate>Sat, 07 Aug 2010 14:15:10 +0000</pubDate>
		<guid isPermaLink="false">http://sandbox-ws.com/?p=261#comment-6351</guid>
		<description>@toms nice work, thanks</description>
		<content:encoded><![CDATA[<p>@toms nice work, thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Toms</title>
		<link>http://sandbox-ws.com/frameworks/symfony-frameworks/how-to-embed-forms-in-symfony-12-admin-generator-part-2/comment-page-2#comment-6350</link>
		<dc:creator>Toms</dc:creator>
		<pubDate>Sun, 01 Aug 2010 22:51:45 +0000</pubDate>
		<guid isPermaLink="false">http://sandbox-ws.com/?p=261#comment-6350</guid>
		<description>Thanks a lot for your work ! 
But I moved the call to the controller into the actions.class.php, because is recommanded, like :

// in module/actions/actions.class.php
executeEdit(sfWebRequest $request){
$options = array(&#039;controller&#039; =&gt; $this-&gt;getController());
		
$this-&gt;form = new CentreJourForm($this-&gt;centre_jour, $options ); 
}

//in my form
configure(){
$controller = $this-&gt;getOption(&#039;controller&#039;);
....

And in your widget i have add an option called controller.


I have made the same thing for a relationship many to many if you are interested.
Example with a schema: 
company[idC, name]
charter[immat#, idC#, dateChar]  // Doctrine doesn&#039;t understand this notation because there are an additional column
Plane[immat, type] 

(Sorry for my english I&#039;m french)</description>
		<content:encoded><![CDATA[<p>Thanks a lot for your work !<br />
But I moved the call to the controller into the actions.class.php, because is recommanded, like :</p>
<p>// in module/actions/actions.class.php<br />
executeEdit(sfWebRequest $request){<br />
$options = array(&#8216;controller&#8217; =&gt; $this-&gt;getController());</p>
<p>$this-&gt;form = new CentreJourForm($this-&gt;centre_jour, $options );<br />
}</p>
<p>//in my form<br />
configure(){<br />
$controller = $this-&gt;getOption(&#8216;controller&#8217;);<br />
&#8230;.</p>
<p>And in your widget i have add an option called controller.</p>
<p>I have made the same thing for a relationship many to many if you are interested.<br />
Example with a schema:<br />
company[idC, name]<br />
charter[immat#, idC#, dateChar]  // Doctrine doesn&#8217;t understand this notation because there are an additional column<br />
Plane[immat, type] </p>
<p>(Sorry for my english I&#8217;m french)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshe</title>
		<link>http://sandbox-ws.com/frameworks/symfony-frameworks/how-to-embed-forms-in-symfony-12-admin-generator-part-2/comment-page-2#comment-6346</link>
		<dc:creator>Joshe</dc:creator>
		<pubDate>Sun, 09 May 2010 19:00:24 +0000</pubDate>
		<guid isPermaLink="false">http://sandbox-ws.com/?p=261#comment-6346</guid>
		<description>Gracias por es tutorial es exelente</description>
		<content:encoded><![CDATA[<p>Gracias por es tutorial es exelente</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: geraldo</title>
		<link>http://sandbox-ws.com/frameworks/symfony-frameworks/how-to-embed-forms-in-symfony-12-admin-generator-part-2/comment-page-1#comment-6344</link>
		<dc:creator>geraldo</dc:creator>
		<pubDate>Fri, 16 Apr 2010 23:17:41 +0000</pubDate>
		<guid isPermaLink="false">http://sandbox-ws.com/?p=261#comment-6344</guid>
		<description>great Tutorial, thanks!

about the plans to add multiple embeded forms with AJAX you could give laiguAdminThemePlugina try.</description>
		<content:encoded><![CDATA[<p>great Tutorial, thanks!</p>
<p>about the plans to add multiple embeded forms with AJAX you could give laiguAdminThemePlugina try.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aanchal</title>
		<link>http://sandbox-ws.com/frameworks/symfony-frameworks/how-to-embed-forms-in-symfony-12-admin-generator-part-2/comment-page-1#comment-6343</link>
		<dc:creator>Aanchal</dc:creator>
		<pubDate>Tue, 30 Mar 2010 18:14:16 +0000</pubDate>
		<guid isPermaLink="false">http://sandbox-ws.com/?p=261#comment-6343</guid>
		<description>Hey, Its an awesome blog. 
The trouble I am having is that I want to have a validator on the embedded forms. My requirement is that the values in the embedded forms can&#039;t be duplicated.How can it be achieved??

ur help will be really appreciated.Stuck on it since 4 days :(</description>
		<content:encoded><![CDATA[<p>Hey, Its an awesome blog.<br />
The trouble I am having is that I want to have a validator on the embedded forms. My requirement is that the values in the embedded forms can&#8217;t be duplicated.How can it be achieved??</p>
<p>ur help will be really appreciated.Stuck on it since 4 days <img src='http://sandbox-ws.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tanha</title>
		<link>http://sandbox-ws.com/frameworks/symfony-frameworks/how-to-embed-forms-in-symfony-12-admin-generator-part-2/comment-page-1#comment-6342</link>
		<dc:creator>Tanha</dc:creator>
		<pubDate>Sat, 06 Mar 2010 15:37:23 +0000</pubDate>
		<guid isPermaLink="false">http://sandbox-ws.com/?p=261#comment-6342</guid>
		<description>Great. Looking forward :-)</description>
		<content:encoded><![CDATA[<p>Great. Looking forward <img src='http://sandbox-ws.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ahmed El.Hussaini</title>
		<link>http://sandbox-ws.com/frameworks/symfony-frameworks/how-to-embed-forms-in-symfony-12-admin-generator-part-2/comment-page-1#comment-6341</link>
		<dc:creator>Ahmed El.Hussaini</dc:creator>
		<pubDate>Fri, 05 Mar 2010 08:59:20 +0000</pubDate>
		<guid isPermaLink="false">http://sandbox-ws.com/?p=261#comment-6341</guid>
		<description>@Tanha

Unfortunatly when I wrote this article I didn&#039;t take modifications in generator.yml under consideration but now I&#039;m considering updating the article and I&#039;ll sure take your note along with others under consideration.</description>
		<content:encoded><![CDATA[<p>@Tanha</p>
<p>Unfortunatly when I wrote this article I didn&#8217;t take modifications in generator.yml under consideration but now I&#8217;m considering updating the article and I&#8217;ll sure take your note along with others under consideration.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
