<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mohammed CHERIFI &#187; Symfony</title>
	<atom:link href="http://www.mcherifi.org/tag/symfony/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mcherifi.org</link>
	<description>Another Web Developper Blog!</description>
	<lastBuildDate>Tue, 31 Jan 2012 18:42:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Symfony: Comment corriger l&#8217;erreur &#171;&#160;Can&#8217;t create table (errno: 150)&#160;&#187;?</title>
		<link>http://www.mcherifi.org/developpement-web/symfony/symfony-comment-corriger-lerreur-cant-create-table-errno-150.html</link>
		<comments>http://www.mcherifi.org/developpement-web/symfony/symfony-comment-corriger-lerreur-cant-create-table-errno-150.html#comments</comments>
		<pubDate>Mon, 27 Sep 2010 16:07:58 +0000</pubDate>
		<dc:creator>Mohammed CHERIFI</dc:creator>
				<category><![CDATA[Symfony]]></category>
		<category><![CDATA[errno 150]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.mcherifi.org/?p=773</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.mcherifi.org/developpement-web/symfony/symfony-comment-corriger-lerreur-cant-create-table-errno-150.html" data-text="Symfony: Comment corriger l\'erreur \"Can\'t create table (errno: 150)\"?" data-count="horizontal">Tweet</a><p><a href="http://www.mcherifi.org/wp-content/uploads/2009/10/formulaires_symfony.jpg"><img src="http://www.mcherifi.org/wp-content/uploads/2009/10/formulaires_symfony.jpg" alt="" title="formulaires_symfony" width="165" height="131" class="alignleft size-full wp-image-334" /></a>Après avoir conçu le fichier schema.yml pour une applications de jeux en ligne, j&#8217;ai été surpris par une erreur mysql 150 au moment quand j&#8217;ai exécuté &laquo;&nbsp;php symfony doctrine:build &#8211;all &#8211;and-load &#8211;no-confirmation&nbsp;&raquo;, l&#8217;idée était de pouvoir gérer les permission par rapport à un concours et donner à un utilisateur X les droits pour le faire, la solution la plus naturel afin de l&#8217;intégrer avec <a href="http://www.symfony-project.org/plugins/sfDoctrineGuardPlugin" target="_blank">sfDoctrineGuard</a> est de créer une table avec une relation &laquo;&nbsp;<a href="http://www.doctrine-project.org/documentation/manual/1_1/1_1/yaml-schema-files:relationships:many-to-many" target="blank">many to many</a>&laquo;&nbsp;, voici donc ce que contenais mon fichier schma.yml pour la table concernée : </p>
<pre class="brush: php">
################## Questions ##################
Concours:
  columns:
    id: { type: integer(4), primary: true, autoincrement: true}
    name: string(250)
    ....
############ Gestion des Permissions ############
sfGuardConcoursUser:
  columns:
    user_id: { type: integer, primary: true}
    concours_id: { type: integer, primary: true}
  relations:
    Concours: { local: concours_id, foreign: id, foreignAlias: sfGuardConcoursUserConcours, onDelete: CASCADE }
    sfGuardUser: { local: user_id, foreign: id, foreignAlias: sfGuardConcoursUsersfGuardUser, onDelete: CASCADE }
</pre>
<h2>Problème</h2>
<p>Après avoir fait un &laquo;&nbsp;php symfony doctrine:build &#8211;all &#8211;and-load &#8211;no-confirmation&nbsp;&raquo;, j&#8217;ai eu droit à cette erreur:</p>
<blockquote><p>SQLSTATE[HY000]: General error: 1005 Can&#8217;t create table &#8216;test.#sql-529_3dab&#8217; (errno: 150). Failing Query: &laquo;&nbsp;ALTER TABLE jeux_concours ADD CONSTRAINT jeux_concours_concours_id_user_id FOREIGN KEY (concours_id) REFERENCES concours</p></blockquote>
<h2>Solution?</h2>
<p>Et Oui c&#8217;est l&#8217;une des erreurs qui m&#8217;ont fait chier pendant une heure pour trouver d&#8217;où ça provient, pour vous faire gagner du temps, voici la recette magique ;) :</p>
<p>Pour mysql <strong>les relations &laquo;&nbsp;many to many&nbsp;&raquo; doivent avoir toujours le même type et la même longueur des champs clés</strong>, vous remarquez bien que le champ Concours[id] est du type integer(4), par-contre dans la table sfGuardConcoursUser il est du type integer, il n&#8217;a donc pas la même longueur et c&#8217;est à cause de cette différence que l&#8217;erreur 150 s&#8217;est produite.</p>
<p>La solution est très simple, il suffit de mettre integer comme type pour le champ id de la table Concours au lieu de integer(4) et Bingo!</p>
<p>Happy coding</p>



Partager cet article:


	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/wp-content/plugins/sociable/awesmate.php?c=twitter&t=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&d=http://twitter.com/home?status=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F%20-%20TARGET" title="Twitter"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/wp-content/plugins/sociable/awesmate.php?c=facebook-post&t=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&d=http://www.facebook.com/share.php?u=TARGET%26t=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F" title="Facebook"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&amp;title=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F&amp;annotation=Apr%C3%A8s%20avoir%20con%C3%A7u%20le%20fichier%20schema.yml%20pour%20une%20applications%20de%20jeux%20en%20ligne%2C%20j%27ai%20%C3%A9t%C3%A9%20surpris%20par%20une%20erreur%20mysql%20150%20au%20moment%20quand%20j%27ai%20ex%C3%A9cut%C3%A9%20%22php%20symfony%20doctrine%3Abuild%20--all%20--and-load%20--no-confirmation%22%2C%20l%27id%C3%A9e%20%C3%A9tait%20de%20pouvoir%20g%C3" title="Google Bookmarks"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&amp;title=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F&amp;notes=Apr%C3%A8s%20avoir%20con%C3%A7u%20le%20fichier%20schema.yml%20pour%20une%20applications%20de%20jeux%20en%20ligne%2C%20j%27ai%20%C3%A9t%C3%A9%20surpris%20par%20une%20erreur%20mysql%20150%20au%20moment%20quand%20j%27ai%20ex%C3%A9cut%C3%A9%20%22php%20symfony%20doctrine%3Abuild%20--all%20--and-load%20--no-confirmation%22%2C%20l%27id%C3%A9e%20%C3%A9tait%20de%20pouvoir%20g%C3" title="del.icio.us"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html" title="Netvibes"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&title=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F&urllanguage=fr" title="viadeo FR"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/viadeo.png" title="viadeo FR" alt="viadeo FR" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&amp;title=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F&amp;bodytext=Apr%C3%A8s%20avoir%20con%C3%A7u%20le%20fichier%20schema.yml%20pour%20une%20applications%20de%20jeux%20en%20ligne%2C%20j%27ai%20%C3%A9t%C3%A9%20surpris%20par%20une%20erreur%20mysql%20150%20au%20moment%20quand%20j%27ai%20ex%C3%A9cut%C3%A9%20%22php%20symfony%20doctrine%3Abuild%20--all%20--and-load%20--no-confirmation%22%2C%20l%27id%C3%A9e%20%C3%A9tait%20de%20pouvoir%20g%C3" title="Digg"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&amp;title=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F&amp;source=Mohammed+CHERIFI+Another+Web+Developper+Blog%21&amp;summary=Apr%C3%A8s%20avoir%20con%C3%A7u%20le%20fichier%20schema.yml%20pour%20une%20applications%20de%20jeux%20en%20ligne%2C%20j%27ai%20%C3%A9t%C3%A9%20surpris%20par%20une%20erreur%20mysql%20150%20au%20moment%20quand%20j%27ai%20ex%C3%A9cut%C3%A9%20%22php%20symfony%20doctrine%3Abuild%20--all%20--and-load%20--no-confirmation%22%2C%20l%27id%C3%A9e%20%C3%A9tait%20de%20pouvoir%20g%C3" title="LinkedIn"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html" title="Slashdot"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html" title="Sphinn"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&amp;title=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F" title="Mixx"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a  target="_blank" href="http://blogplay.com" title="Blogplay"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/blogplay.png" title="Blogplay" alt="Blogplay" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html" title="Identi.ca"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&amp;partner=sociable" title="Print"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/wp-content/plugins/sociable/awesmate.php?c=pingfm&t=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&d=http://ping.fm/ref/?link=TARGET%26title=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F%26body=Apr%C3%A8s%20avoir%20con%C3%A7u%20le%20fichier%20schema.yml%20pour%20une%20applications%20de%20jeux%20en%20ligne%2C%20j%27ai%20%C3%A9t%C3%A9%20surpris%20par%20une%20erreur%20mysql%20150%20au%20moment%20quand%20j%27ai%20ex%C3%A9cut%C3%A9%20%22php%20symfony%20doctrine%3Abuild%20--all%20--and-load%20--no-confirmation%22%2C%20l%27id%C3%A9e%20%C3%A9tait%20de%20pouvoir%20g%C3" title="Ping.fm"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/wp-content/plugins/sociable/awesmate.php?c=mailto&t=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&d=mailto:?subject=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F%26body=TARGET" title="email"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://posterous.com/share?linkto=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&amp;title=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F&amp;selection=Apr%C3%A8s%20avoir%20con%C3%A7u%20le%20fichier%20schema.yml%20pour%20une%20applications%20de%20jeux%20en%20ligne%2C%20j%27ai%20%C3%A9t%C3%A9%20surpris%20par%20une%20erreur%20mysql%20150%20au%20moment%20quand%20j%27ai%20ex%C3%A9cut%C3%A9%20%22php%20symfony%20doctrine%3Abuild%20--all%20--and-load%20--no-confirmation%22%2C%20l%27id%C3%A9e%20%C3%A9tait%20de%20pouvoir%20g%C3" title="Posterous"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/posterous.png" title="Posterous" alt="Posterous" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&amp;title=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F" title="Reddit"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&amp;submitHeadline=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F&amp;submitSummary=Apr%C3%A8s%20avoir%20con%C3%A7u%20le%20fichier%20schema.yml%20pour%20une%20applications%20de%20jeux%20en%20ligne%2C%20j%27ai%20%C3%A9t%C3%A9%20surpris%20par%20une%20erreur%20mysql%20150%20au%20moment%20quand%20j%27ai%20ex%C3%A9cut%C3%A9%20%22php%20symfony%20doctrine%3Abuild%20--all%20--and-load%20--no-confirmation%22%2C%20l%27id%C3%A9e%20%C3%A9tait%20de%20pouvoir%20g%C3&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&amp;partner=sociable" title="PDF"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/feed" title="RSS"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&amp;title=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F" title="Diigo"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/diigo.png" title="Diigo" alt="Diigo" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://cgi.fark.com/cgi/fark/farkit.pl?h=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F&amp;u=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html" title="Fark"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.blogospherenews.com/submit.php?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html&amp;title=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F" title="Blogosphere News"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/blogospherenews.png" title="Blogosphere News" alt="Blogosphere News" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://cimlap.blogter.hu/index.php?action=suggest_link&amp;title=Symfony%3A%20Comment%20corriger%20l%27erreur%20%22Can%27t%20create%20table%20%28errno%3A%20150%29%22%3F&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html" title="blogtercimlap"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/blogter.png" title="blogtercimlap" alt="blogtercimlap" class="sociable-hovers" /></a>


<br/><br/>
<p class="FacebookLikeButton"><fb:like href="http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-comment-corriger-lerreur-cant-create-table-errno-150.html" layout="standard" show_faces="true" width="450" action="like" colorscheme="light"></fb:like></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcherifi.org/developpement-web/symfony/symfony-comment-corriger-lerreur-cant-create-table-errno-150.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>symfony: Utiliser sfWidgetFormJQueryDate avec sfFormExtraPlugin</title>
		<link>http://www.mcherifi.org/developpement-web/symfony/symfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html</link>
		<comments>http://www.mcherifi.org/developpement-web/symfony/symfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html#comments</comments>
		<pubDate>Thu, 01 Apr 2010 17:45:27 +0000</pubDate>
		<dc:creator>Mohammed CHERIFI</dc:creator>
				<category><![CDATA[Symfony]]></category>
		<category><![CDATA[datepicker]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jqueryui]]></category>
		<category><![CDATA[sfFormExtraPlugin]]></category>
		<category><![CDATA[sfWidgetFormJQueryDate]]></category>
		<category><![CDATA[symfony datepicker]]></category>

		<guid isPermaLink="false">http://www.mcherifi.org/?p=665</guid>
		<description><![CDATA[Tweet
Vu le très peu de documentation que j&#8217;ai pu trouvé au sujet du plugin sfFormExtraPlugin de symfony, voici un guide rapide qui vous permettra d&#8217;installer le plugin sfFormExtraPlugin et pouvoir afficher un calendrier pour les champs de type date grâce au widget sfWidgetFormJQueryDate, voici donc les étapes à suivre:
1 &#8211; Installer le plugin sfFormExtraPlugin
En mode [...]]]></description>
			<content:encoded><![CDATA[<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.mcherifi.org/developpement-web/symfony/symfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html" data-text="symfony: Utiliser sfWidgetFormJQueryDate avec sfFormExtraPlugin" data-count="horizontal">Tweet</a><p><a href="http://www.mcherifi.org/wp-content/uploads/2010/04/sfWidgetFormJQueryDate.jpg"><img src="http://www.mcherifi.org/wp-content/uploads/2010/04/sfWidgetFormJQueryDate.jpg" alt="" title="Résultat" width="666" height="208" class="aligncenter size-full wp-image-672" /></a></p>
<p>Vu le très peu de documentation que j&#8217;ai pu trouvé au sujet du plugin sfFormExtraPlugin de symfony, voici un guide rapide qui vous permettra d&#8217;installer le plugin sfFormExtraPlugin et pouvoir afficher un calendrier pour les champs de type date grâce au widget sfWidgetFormJQueryDate, voici donc les étapes à suivre:<br />
<h2>1 &#8211; Installer le plugin sfFormExtraPlugin</h2>
<p>En mode console, positionnez vous sur le dossier d&#8217;installation du projet et exécuter : </p>
<pre class="brush: plain">./symfony plugin:install sfFormExtraPlugin</pre>
<h2>2 &#8211; Télecharger et mettre en place les librairies jQuery nécessaire</h2>
<p>Malheureusement le plugin sfFormExtraPlugin n&#8217;inclue pas les librairies externes nécessaire au fonctionnement, il faut le faire à la main!</p>
<p>il faut donc télécharger JQuery et <acronym title="JQuery User Interface">JQuery UI</acronym>:</p>
<ul>
<li>Allez sur le site de <a href="http://jqueryui.com/download" target="_blank">jQuery UI</a></li>
<li>Dans la liste des composants déchochez toutes les cases sauf  Core et Datepicker</li>
<li>Sélectionner le thème qui vous convient à droite et cliquez Télécharger</li>
</ul>
<h2>3 &#8211; Placé les fichiers téléchargés dans le dossier web et modifier le fichier view.yml</h2>
<p>Décompresser jquery-ui-1.8custom.zip et copier les fichiers décompresser vers le dossier web ainsi:</p>
<ul>
<li>js/jquery-1.4.2.min.js et js/jquery-ui-1.8.custom.min.js dans le dossier /web/js</li>
<li>css/jquery-ui-1.8.custom.css dans le dossier /web/css</li>
<li>renommer le dossier css/theme/images/ en jquery-ui-images et mettez le dans /web/images/</li>
<li>Ouvrez le fichier /web/css/jquery-ui-1.8.custom.css et remplacer &laquo;&nbsp;images/&nbsp;&raquo; par &laquo;&nbsp;../images/jquery-ui-images/&nbsp;&raquo; pour corriger le chemin vers les images</li>
<li><a href="http://www.mcherifi.org/wp-content/uploads/2010/04/calendar.png" target="_blank">calendar.png</a> une petite icône qu&#8217;on affiche à coté du champs pour faire joli :p (à mettre dans /web/images/) </li>
</ul>
<p>Maintenant il faut inclure les fichiers javascript et css dans view.yml de notre application (par exemple /apps/backend/config/view.yml) :</p>
<p><strong>Ajout du fichier javascript</strong></p>
<pre class="brush: plain">
    javascripts:    [jquery-1.4.2.min.js, jquery-ui-1.8.custom.min.js]
</pre>
<p><strong>Ajout du fichier css</strong></p>
<pre class="brush: plain">
    stylesheets:    [jquery-ui-1.8.custom.css]
</pre>
<h2>4 &#8211; Mise en place du Widget dans la classe du formulaire</h2>
<pre class="brush: php">
class PrescripteursForm extends BasePrescripteursForm
{
  public function configure()
  {
    $this-&gt;widgetSchema[&#039;date_debut&#039;] = new sfWidgetFormJQueryDate(array(&#039;image&#039;=&gt;&#039;/images/calendar.png&#039;));
    $this-&gt;widgetSchema[&#039;date_fin&#039;] = new sfWidgetFormJQueryDate(array(&#039;image&#039;=&gt;&#039;/images/calendar.png&#039;));
  }
}
</pre>
<p>Et le tour est joué ;) ça devrai ressembler à ça : </p>
<p><a href="http://www.mcherifi.org/wp-content/uploads/2010/04/datewidgetOK.jpg"><br />
<img src="http://www.mcherifi.org/wp-content/uploads/2010/04/datewidgetOK.jpg" alt="" title="datewidgetOK" width="391" height="214" class="aligncenter size-full wp-image-669" /></a></p>



Partager cet article:


	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/wp-content/plugins/sociable/awesmate.php?c=twitter&t=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&d=http://twitter.com/home?status=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin%20-%20TARGET" title="Twitter"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/wp-content/plugins/sociable/awesmate.php?c=facebook-post&t=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&d=http://www.facebook.com/share.php?u=TARGET%26t=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin" title="Facebook"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&amp;title=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin&amp;annotation=%0D%0AVu%20le%20tr%C3%A8s%20peu%20de%20documentation%20que%20j%27ai%20pu%20trouv%C3%A9%20au%20sujet%20du%20plugin%20sfFormExtraPlugin%20de%20symfony%2C%20voici%20un%20guide%20rapide%20qui%20vous%20permettra%20d%27installer%20le%20plugin%20sfFormExtraPlugin%20et%20pouvoir%20afficher%20un%20calendrier%20pour%20les%20champs%20de%20type%20date%20gr" title="Google Bookmarks"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&amp;title=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin&amp;notes=%0D%0AVu%20le%20tr%C3%A8s%20peu%20de%20documentation%20que%20j%27ai%20pu%20trouv%C3%A9%20au%20sujet%20du%20plugin%20sfFormExtraPlugin%20de%20symfony%2C%20voici%20un%20guide%20rapide%20qui%20vous%20permettra%20d%27installer%20le%20plugin%20sfFormExtraPlugin%20et%20pouvoir%20afficher%20un%20calendrier%20pour%20les%20champs%20de%20type%20date%20gr" title="del.icio.us"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html" title="Netvibes"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&title=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin&urllanguage=fr" title="viadeo FR"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/viadeo.png" title="viadeo FR" alt="viadeo FR" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&amp;title=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin&amp;bodytext=%0D%0AVu%20le%20tr%C3%A8s%20peu%20de%20documentation%20que%20j%27ai%20pu%20trouv%C3%A9%20au%20sujet%20du%20plugin%20sfFormExtraPlugin%20de%20symfony%2C%20voici%20un%20guide%20rapide%20qui%20vous%20permettra%20d%27installer%20le%20plugin%20sfFormExtraPlugin%20et%20pouvoir%20afficher%20un%20calendrier%20pour%20les%20champs%20de%20type%20date%20gr" title="Digg"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&amp;title=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin&amp;source=Mohammed+CHERIFI+Another+Web+Developper+Blog%21&amp;summary=%0D%0AVu%20le%20tr%C3%A8s%20peu%20de%20documentation%20que%20j%27ai%20pu%20trouv%C3%A9%20au%20sujet%20du%20plugin%20sfFormExtraPlugin%20de%20symfony%2C%20voici%20un%20guide%20rapide%20qui%20vous%20permettra%20d%27installer%20le%20plugin%20sfFormExtraPlugin%20et%20pouvoir%20afficher%20un%20calendrier%20pour%20les%20champs%20de%20type%20date%20gr" title="LinkedIn"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html" title="Slashdot"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html" title="Sphinn"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&amp;title=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin" title="Mixx"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a  target="_blank" href="http://blogplay.com" title="Blogplay"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/blogplay.png" title="Blogplay" alt="Blogplay" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html" title="Identi.ca"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&amp;partner=sociable" title="Print"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/wp-content/plugins/sociable/awesmate.php?c=pingfm&t=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&d=http://ping.fm/ref/?link=TARGET%26title=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin%26body=%0D%0AVu%20le%20tr%C3%A8s%20peu%20de%20documentation%20que%20j%27ai%20pu%20trouv%C3%A9%20au%20sujet%20du%20plugin%20sfFormExtraPlugin%20de%20symfony%2C%20voici%20un%20guide%20rapide%20qui%20vous%20permettra%20d%27installer%20le%20plugin%20sfFormExtraPlugin%20et%20pouvoir%20afficher%20un%20calendrier%20pour%20les%20champs%20de%20type%20date%20gr" title="Ping.fm"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/wp-content/plugins/sociable/awesmate.php?c=mailto&t=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&d=mailto:?subject=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin%26body=TARGET" title="email"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://posterous.com/share?linkto=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&amp;title=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin&amp;selection=%0D%0AVu%20le%20tr%C3%A8s%20peu%20de%20documentation%20que%20j%27ai%20pu%20trouv%C3%A9%20au%20sujet%20du%20plugin%20sfFormExtraPlugin%20de%20symfony%2C%20voici%20un%20guide%20rapide%20qui%20vous%20permettra%20d%27installer%20le%20plugin%20sfFormExtraPlugin%20et%20pouvoir%20afficher%20un%20calendrier%20pour%20les%20champs%20de%20type%20date%20gr" title="Posterous"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/posterous.png" title="Posterous" alt="Posterous" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&amp;title=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin" title="Reddit"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&amp;submitHeadline=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin&amp;submitSummary=%0D%0AVu%20le%20tr%C3%A8s%20peu%20de%20documentation%20que%20j%27ai%20pu%20trouv%C3%A9%20au%20sujet%20du%20plugin%20sfFormExtraPlugin%20de%20symfony%2C%20voici%20un%20guide%20rapide%20qui%20vous%20permettra%20d%27installer%20le%20plugin%20sfFormExtraPlugin%20et%20pouvoir%20afficher%20un%20calendrier%20pour%20les%20champs%20de%20type%20date%20gr&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&amp;partner=sociable" title="PDF"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/feed" title="RSS"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&amp;title=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin" title="Diigo"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/diigo.png" title="Diigo" alt="Diigo" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://cgi.fark.com/cgi/fark/farkit.pl?h=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin&amp;u=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html" title="Fark"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.blogospherenews.com/submit.php?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html&amp;title=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin" title="Blogosphere News"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/blogospherenews.png" title="Blogosphere News" alt="Blogosphere News" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://cimlap.blogter.hu/index.php?action=suggest_link&amp;title=symfony%3A%20Utiliser%20sfWidgetFormJQueryDate%20avec%20sfFormExtraPlugin&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html" title="blogtercimlap"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/blogter.png" title="blogtercimlap" alt="blogtercimlap" class="sociable-hovers" /></a>


<br/><br/>
<p class="FacebookLikeButton"><fb:like href="http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fsymfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html" layout="standard" show_faces="true" width="450" action="like" colorscheme="light"></fb:like></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcherifi.org/developpement-web/symfony/symfony-utiliser-sfwidgetformjquerydate-avec-sfformextraplugin.html/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>[VIDEO] : Python or PHP? that is the question!</title>
		<link>http://www.mcherifi.org/divers/humour/video-python-or-php-that-is-the-question.html</link>
		<comments>http://www.mcherifi.org/divers/humour/video-python-or-php-that-is-the-question.html#comments</comments>
		<pubDate>Thu, 10 Dec 2009 18:07:36 +0000</pubDate>
		<dc:creator>Mohammed CHERIFI</dc:creator>
				<category><![CDATA[Humour]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[phyton vs php]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://www.mcherifi.org/?p=499</guid>
		<description><![CDATA[TweetPython ou PHP pour le développement WEB? humm, c&#8217;est une question à laquelle je peux pas répondre,  c&#8217;est vrai ça fait quelques mois que je m&#8217;intéresse à python, particulièrement au framework django qui me parait super élégant en terme d&#8217;ergonomie et l&#8217;implémentation du pattern MVC OO, mais bon ce n&#8217;est pas notre sujet, j&#8217;y [...]]]></description>
			<content:encoded><![CDATA[<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.mcherifi.org/divers/humour/video-python-or-php-that-is-the-question.html" data-text="[VIDEO] : Python or PHP? that is the question!" data-count="horizontal">Tweet</a><p>Python ou PHP pour le développement WEB? humm, c&#8217;est une question à laquelle je peux pas répondre,  c&#8217;est vrai ça fait quelques mois que je m&#8217;intéresse à python, particulièrement au framework django qui me parait super élégant en terme d&#8217;ergonomie et l&#8217;implémentation du pattern MVC OO, mais bon ce n&#8217;est pas notre sujet, j&#8217;y reviendrai dans un prochain billet peut être!</p>
<p>Je vous invites à voir cette vidéo trop marrante réalisée par <a href="http://www.miximum.fr/">Thibault Jouannic</a>, j&#8217;espère que vous aimerai bien :D</p>
<div align="center"><object width="480" height="275"><param name="movie" value="http://www.dailymotion.com/swf/xbfjlq&#038;related=0"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.dailymotion.com/swf/xbfjlq&#038;related=0" type="application/x-shockwave-flash" width="480" height="275" allowfullscreen="true" allowscriptaccess="always"></embed></object></div>



Partager cet article:


	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/wp-content/plugins/sociable/awesmate.php?c=twitter&t=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&d=http://twitter.com/home?status=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21%20-%20TARGET" title="Twitter"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/wp-content/plugins/sociable/awesmate.php?c=facebook-post&t=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&d=http://www.facebook.com/share.php?u=TARGET%26t=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21" title="Facebook"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&amp;title=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21&amp;annotation=Python%20ou%20PHP%20pour%20le%20d%C3%A9veloppement%20WEB%3F%20humm%2C%20c%27est%20une%20question%20%C3%A0%20laquelle%20je%20peux%20pas%20r%C3%A9pondre%2C%20%20c%27est%20vrai%20%C3%A7a%20fait%20quelques%20mois%20que%20je%20m%27int%C3%A9resse%20%C3%A0%20python%2C%20particuli%C3%A8rement%20au%20framework%20django%20qui%20me%20parait%20super%20%C3%A9l%C3%A9gant%20en%20terme%20d%27erg" title="Google Bookmarks"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&amp;title=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21&amp;notes=Python%20ou%20PHP%20pour%20le%20d%C3%A9veloppement%20WEB%3F%20humm%2C%20c%27est%20une%20question%20%C3%A0%20laquelle%20je%20peux%20pas%20r%C3%A9pondre%2C%20%20c%27est%20vrai%20%C3%A7a%20fait%20quelques%20mois%20que%20je%20m%27int%C3%A9resse%20%C3%A0%20python%2C%20particuli%C3%A8rement%20au%20framework%20django%20qui%20me%20parait%20super%20%C3%A9l%C3%A9gant%20en%20terme%20d%27erg" title="del.icio.us"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html" title="Netvibes"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&title=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21&urllanguage=fr" title="viadeo FR"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/viadeo.png" title="viadeo FR" alt="viadeo FR" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&amp;title=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21&amp;bodytext=Python%20ou%20PHP%20pour%20le%20d%C3%A9veloppement%20WEB%3F%20humm%2C%20c%27est%20une%20question%20%C3%A0%20laquelle%20je%20peux%20pas%20r%C3%A9pondre%2C%20%20c%27est%20vrai%20%C3%A7a%20fait%20quelques%20mois%20que%20je%20m%27int%C3%A9resse%20%C3%A0%20python%2C%20particuli%C3%A8rement%20au%20framework%20django%20qui%20me%20parait%20super%20%C3%A9l%C3%A9gant%20en%20terme%20d%27erg" title="Digg"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&amp;title=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21&amp;source=Mohammed+CHERIFI+Another+Web+Developper+Blog%21&amp;summary=Python%20ou%20PHP%20pour%20le%20d%C3%A9veloppement%20WEB%3F%20humm%2C%20c%27est%20une%20question%20%C3%A0%20laquelle%20je%20peux%20pas%20r%C3%A9pondre%2C%20%20c%27est%20vrai%20%C3%A7a%20fait%20quelques%20mois%20que%20je%20m%27int%C3%A9resse%20%C3%A0%20python%2C%20particuli%C3%A8rement%20au%20framework%20django%20qui%20me%20parait%20super%20%C3%A9l%C3%A9gant%20en%20terme%20d%27erg" title="LinkedIn"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html" title="Slashdot"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html" title="Sphinn"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&amp;title=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21" title="Mixx"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a  target="_blank" href="http://blogplay.com" title="Blogplay"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/blogplay.png" title="Blogplay" alt="Blogplay" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html" title="Identi.ca"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&amp;partner=sociable" title="Print"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/wp-content/plugins/sociable/awesmate.php?c=pingfm&t=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&d=http://ping.fm/ref/?link=TARGET%26title=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21%26body=Python%20ou%20PHP%20pour%20le%20d%C3%A9veloppement%20WEB%3F%20humm%2C%20c%27est%20une%20question%20%C3%A0%20laquelle%20je%20peux%20pas%20r%C3%A9pondre%2C%20%20c%27est%20vrai%20%C3%A7a%20fait%20quelques%20mois%20que%20je%20m%27int%C3%A9resse%20%C3%A0%20python%2C%20particuli%C3%A8rement%20au%20framework%20django%20qui%20me%20parait%20super%20%C3%A9l%C3%A9gant%20en%20terme%20d%27erg" title="Ping.fm"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/wp-content/plugins/sociable/awesmate.php?c=mailto&t=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&d=mailto:?subject=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21%26body=TARGET" title="email"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://posterous.com/share?linkto=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&amp;title=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21&amp;selection=Python%20ou%20PHP%20pour%20le%20d%C3%A9veloppement%20WEB%3F%20humm%2C%20c%27est%20une%20question%20%C3%A0%20laquelle%20je%20peux%20pas%20r%C3%A9pondre%2C%20%20c%27est%20vrai%20%C3%A7a%20fait%20quelques%20mois%20que%20je%20m%27int%C3%A9resse%20%C3%A0%20python%2C%20particuli%C3%A8rement%20au%20framework%20django%20qui%20me%20parait%20super%20%C3%A9l%C3%A9gant%20en%20terme%20d%27erg" title="Posterous"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/posterous.png" title="Posterous" alt="Posterous" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&amp;title=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21" title="Reddit"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&amp;submitHeadline=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21&amp;submitSummary=Python%20ou%20PHP%20pour%20le%20d%C3%A9veloppement%20WEB%3F%20humm%2C%20c%27est%20une%20question%20%C3%A0%20laquelle%20je%20peux%20pas%20r%C3%A9pondre%2C%20%20c%27est%20vrai%20%C3%A7a%20fait%20quelques%20mois%20que%20je%20m%27int%C3%A9resse%20%C3%A0%20python%2C%20particuli%C3%A8rement%20au%20framework%20django%20qui%20me%20parait%20super%20%C3%A9l%C3%A9gant%20en%20terme%20d%27erg&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&amp;partner=sociable" title="PDF"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/feed" title="RSS"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&amp;title=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21" title="Diigo"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/diigo.png" title="Diigo" alt="Diigo" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://cgi.fark.com/cgi/fark/farkit.pl?h=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21&amp;u=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html" title="Fark"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.blogospherenews.com/submit.php?url=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html&amp;title=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21" title="Blogosphere News"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/blogospherenews.png" title="Blogosphere News" alt="Blogosphere News" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://cimlap.blogter.hu/index.php?action=suggest_link&amp;title=%5BVIDEO%5D%20%3A%20Python%20or%20PHP%3F%20that%20is%20the%20question%21&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html" title="blogtercimlap"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/blogter.png" title="blogtercimlap" alt="blogtercimlap" class="sociable-hovers" /></a>


<br/><br/>
<p class="FacebookLikeButton"><fb:like href="http%3A%2F%2Fwww.mcherifi.org%2Fdivers%2Fhumour%2Fvideo-python-or-php-that-is-the-question.html" layout="standard" show_faces="true" width="450" action="like" colorscheme="light"></fb:like></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcherifi.org/divers/humour/video-python-or-php-that-is-the-question.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Manipuler les paramètres de configuration dans symfony</title>
		<link>http://www.mcherifi.org/developpement-web/symfony/manipuler-les-parametres-de-configuration-dans-symfony.html</link>
		<comments>http://www.mcherifi.org/developpement-web/symfony/manipuler-les-parametres-de-configuration-dans-symfony.html#comments</comments>
		<pubDate>Wed, 09 Dec 2009 02:41:31 +0000</pubDate>
		<dc:creator>Mohammed CHERIFI</dc:creator>
				<category><![CDATA[Symfony]]></category>
		<category><![CDATA[app.yml]]></category>
		<category><![CDATA[sfconfig]]></category>
		<category><![CDATA[yaml]]></category>

		<guid isPermaLink="false">http://www.mcherifi.org/?p=462</guid>
		<description><![CDATA[TweetDans symfony, tous les paramètres de configuration sont stockés dans des fichiers .yml (settings.yml, app.yml, module.yml, logging.yml, and i18n.yml), ceux-ci sont accessibles via une classe spéciale sfConfig, certains sont automatiquement utilisés dans le framework!
Lors du développement d&#8217;une application/module symfony, on peut définir des paramètres de configuration spécifiques à notre application, l&#8217;objectif de ce tutoriel est [...]]]></description>
			<content:encoded><![CDATA[<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.mcherifi.org/developpement-web/symfony/manipuler-les-parametres-de-configuration-dans-symfony.html" data-text="Manipuler les paramètres de configuration dans symfony" data-count="horizontal">Tweet</a><p><img class="alignleft size-thumbnail wp-image-335" title="Symfony" src="http://www.mcherifi.org/wp-content/uploads/2009/10/formulaires_symfony-150x150.png" alt="Symfony" width="150" height="150" />Dans symfony, tous les paramètres de configuration sont stockés dans des fichiers .yml (settings.yml, app.yml, module.yml, logging.yml, and i18n.yml), ceux-ci sont accessibles via une classe spéciale sfConfig, certains sont automatiquement utilisés dans le framework!<br />
Lors du développement d&#8217;une application/module symfony, on peut définir des paramètres de configuration spécifiques à notre application, l&#8217;objectif de ce tutoriel est d&#8217;expliquer comment récupérer/modifier les valeurs de ces variables !</p>
<h2>Exemple de fichier de configuration</h2>
<p>On considère que le nom de l&#8217;application est frontend, et le fichier de configuration de l&#8217;application /apps/frontend/config/app.yml </p>
<pre class="brush: plain">all:
  categoryPages:
    maxPages: 10
  productPages:
    maxPages: 5
  generalMax: 15</pre>
<h2>Récupérer une valeur</h2>
<pre class="brush: php">
echo sfConfig::get(&#039;app_categoryPages_maxPages&#039;); // =&gt; 10
echo sfConfig::get(&#039;app_productPages_maxPages&#039;); // =&gt; 5
echo sfConfig::get(&#039;app_generalMax&#039;); // =&gt; 15
</pre>
<p>Symfony utilise le format YAML pour tous ses fichiers de configuration grâce à sa syntaxe simple et efficace, les données sont représentées par une combinaison de listes, tableaux (de hachage) et données scalaires.</p>
<p>L&#8217;accès à une variable se fait via la méthode get() de la classe sfConfig, il suffit d&#8217;indiquer le chemin permettant d&#8217;accéder à la variable, on respectant ces petites règles : </p>
<ul>
<li>Le premier paramètre corrépond au nom d&#8217;un fichier de configuration <u>sans le .yml</u> (settings, app, module, logging, i18n..), ces fichiers se trouve dans le répertoire /apps/NOMAPPLICATION/config/</li>
<li>Il ne faut pas mentionner le &laquo;&nbsp;all&nbsp;&raquo; ou &laquo;&nbsp;default&nbsp;&raquo; dans la méthode sfConfig::get()</li>
<li>Séparez les paramètres par des &laquo;&nbsp;_&nbsp;&raquo; en respectant arborescence selon le fichier .yml</li>
<li>Il est préférable de ne pas utilisé des &laquo;&nbsp;_&nbsp;&raquo; dans le nom des paramètres pour éviter un éventuel conflit</li>
</ul>
<h2>Modifier la valeur d&#8217;un paramètre &laquo;&nbsp;on the fly&nbsp;&raquo;</h2>
<p>La méthode set de la classe sfConfig permet la modification de la valeur d&#8217;un paramètre de configuration, cette modificationn&#8217;est pas permanente, et n&#8217;affecte pas le fichier de configuration concerné:<br />
Exemple :  </p>
<pre class="brush: php">sfConfig::set(&#039;sf_timeout&#039;, 86400);</pre>
<h2>Modifier un paramètre dans le fichier yml</h2>
<p>Par défaut, symfony ne gère pas l&#8217;écriture dans les fichiers de configuration, il n&#8217;y a donc pas de méthode save() dans la classe sfConfig, néanmoins il fourni d&#8217;autre méthodes permettant la réalisation de cette tache:</p>
<p><strong>Exemple :</strong></p>
<p>Modifier app_categoryPages_maxPages dans /apps/frontend/config/app.yml </p>
<pre class="brush: plain">all:
  categoryPages:
    maxPages: 10
  productPages:
    maxPages: 5
  generalMax: 15</pre>
<p>Dans actions.class.php</p>
<pre class="brush: php">$app_config_file = sfConfig::get(&#039;sf_app_config_dir&#039;).&quot;/app.yml&quot;;
$config_values = sfYaml::load($app_config_file);
$config_values[&#039;all&#039;][&#039;categoryPages&#039;][&#039;imap_maxPages&#039;] = 20; // à titre d&#039;exemple
$content = sfYaml::dump($config_values);
file_put_contents($app_config_file, $content);</pre>
<p>sfYaml::load() retourne un tableau associatif contenant les paramètres de configuration du fichier passé en paramètre, sfYaml::dump() permet de génerer le code YAML à partir d&#8217;un tableau sur-lequel on a effectué nos modifications. sans oublier que le chemin du fichier en question doit être inscriptible (+w) pour permettre l&#8217;écriture des nouveaux paramètres</p>
<h2>Pourquoi symfony ne gère pas l&#8217;écriture dans les fichiers YML?</h2>
<p>Je vous rassure, ce n&#8217;est pas un oubli ;) au début ça m&#8217;a fait un peu bizarre mais voilà pourquoi  :</p>
<ul>
<li>Dans symfony, les paramètres de configuration ne découlent pas d’un seul fichier mais de plusieurs fichiers yml (en cascade), on saura pas lequel des fichiers modifier</li>
<li>Sur un serveur de développement, tous les fichiers YAML sont version-nés, si ceux-ci sont édités, il y aura des conflits au moment de mettre à jour par le biais du SVN/GIT</li>
<li>Les fichiers YAML ne sont pas destinés à être modifiés dynamiquement surtout dans un projets collaboratif  (sauf cas particulier)</li>
</ul>
<p>Un grand merci à Charles, Jérôme et François qui m&#8217;ont éclairci les idées à ce sujet =) </p>
<p>Voilà, ce billet touche à sa fin, à très bientôt ;)</p>



Partager cet article:


	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/wp-content/plugins/sociable/awesmate.php?c=twitter&t=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&d=http://twitter.com/home?status=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony%20-%20TARGET" title="Twitter"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/wp-content/plugins/sociable/awesmate.php?c=facebook-post&t=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&d=http://www.facebook.com/share.php?u=TARGET%26t=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony" title="Facebook"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&amp;title=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony&amp;annotation=Dans%20symfony%2C%20tous%20les%20param%C3%A8tres%20de%20configuration%20sont%20stock%C3%A9s%20dans%20des%20fichiers%20.yml%20%28settings.yml%2C%20app.yml%2C%20module.yml%2C%20logging.yml%2C%20and%20i18n.yml%29%2C%20ceux-ci%20sont%20accessibles%20via%20une%20classe%20sp%C3%A9ciale%20sfConfig%2C%20certains%20sont%20automatiquement%20utilis%C3" title="Google Bookmarks"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&amp;title=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony&amp;notes=Dans%20symfony%2C%20tous%20les%20param%C3%A8tres%20de%20configuration%20sont%20stock%C3%A9s%20dans%20des%20fichiers%20.yml%20%28settings.yml%2C%20app.yml%2C%20module.yml%2C%20logging.yml%2C%20and%20i18n.yml%29%2C%20ceux-ci%20sont%20accessibles%20via%20une%20classe%20sp%C3%A9ciale%20sfConfig%2C%20certains%20sont%20automatiquement%20utilis%C3" title="del.icio.us"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html" title="Netvibes"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&title=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony&urllanguage=fr" title="viadeo FR"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/viadeo.png" title="viadeo FR" alt="viadeo FR" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&amp;title=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony&amp;bodytext=Dans%20symfony%2C%20tous%20les%20param%C3%A8tres%20de%20configuration%20sont%20stock%C3%A9s%20dans%20des%20fichiers%20.yml%20%28settings.yml%2C%20app.yml%2C%20module.yml%2C%20logging.yml%2C%20and%20i18n.yml%29%2C%20ceux-ci%20sont%20accessibles%20via%20une%20classe%20sp%C3%A9ciale%20sfConfig%2C%20certains%20sont%20automatiquement%20utilis%C3" title="Digg"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&amp;title=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony&amp;source=Mohammed+CHERIFI+Another+Web+Developper+Blog%21&amp;summary=Dans%20symfony%2C%20tous%20les%20param%C3%A8tres%20de%20configuration%20sont%20stock%C3%A9s%20dans%20des%20fichiers%20.yml%20%28settings.yml%2C%20app.yml%2C%20module.yml%2C%20logging.yml%2C%20and%20i18n.yml%29%2C%20ceux-ci%20sont%20accessibles%20via%20une%20classe%20sp%C3%A9ciale%20sfConfig%2C%20certains%20sont%20automatiquement%20utilis%C3" title="LinkedIn"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://slashdot.org/bookmark.pl?title=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html" title="Slashdot"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html" title="Sphinn"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/sphinn.png" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&amp;title=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony" title="Mixx"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a  target="_blank" href="http://blogplay.com" title="Blogplay"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/blogplay.png" title="Blogplay" alt="Blogplay" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html" title="Identi.ca"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&amp;partner=sociable" title="Print"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/wp-content/plugins/sociable/awesmate.php?c=pingfm&t=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&d=http://ping.fm/ref/?link=TARGET%26title=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony%26body=Dans%20symfony%2C%20tous%20les%20param%C3%A8tres%20de%20configuration%20sont%20stock%C3%A9s%20dans%20des%20fichiers%20.yml%20%28settings.yml%2C%20app.yml%2C%20module.yml%2C%20logging.yml%2C%20and%20i18n.yml%29%2C%20ceux-ci%20sont%20accessibles%20via%20une%20classe%20sp%C3%A9ciale%20sfConfig%2C%20certains%20sont%20automatiquement%20utilis%C3" title="Ping.fm"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/wp-content/plugins/sociable/awesmate.php?c=mailto&t=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&d=mailto:?subject=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony%26body=TARGET" title="email"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://posterous.com/share?linkto=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&amp;title=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony&amp;selection=Dans%20symfony%2C%20tous%20les%20param%C3%A8tres%20de%20configuration%20sont%20stock%C3%A9s%20dans%20des%20fichiers%20.yml%20%28settings.yml%2C%20app.yml%2C%20module.yml%2C%20logging.yml%2C%20and%20i18n.yml%29%2C%20ceux-ci%20sont%20accessibles%20via%20une%20classe%20sp%C3%A9ciale%20sfConfig%2C%20certains%20sont%20automatiquement%20utilis%C3" title="Posterous"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/posterous.png" title="Posterous" alt="Posterous" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&amp;title=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony" title="Reddit"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&amp;submitHeadline=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony&amp;submitSummary=Dans%20symfony%2C%20tous%20les%20param%C3%A8tres%20de%20configuration%20sont%20stock%C3%A9s%20dans%20des%20fichiers%20.yml%20%28settings.yml%2C%20app.yml%2C%20module.yml%2C%20logging.yml%2C%20and%20i18n.yml%29%2C%20ceux-ci%20sont%20accessibles%20via%20une%20classe%20sp%C3%A9ciale%20sfConfig%2C%20certains%20sont%20automatiquement%20utilis%C3&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&amp;partner=sociable" title="PDF"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.mcherifi.org/feed" title="RSS"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.diigo.com/post?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&amp;title=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony" title="Diigo"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/diigo.png" title="Diigo" alt="Diigo" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://cgi.fark.com/cgi/fark/farkit.pl?h=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony&amp;u=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html" title="Fark"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/fark.png" title="Fark" alt="Fark" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.blogospherenews.com/submit.php?url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html&amp;title=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony" title="Blogosphere News"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/blogospherenews.png" title="Blogosphere News" alt="Blogosphere News" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://cimlap.blogter.hu/index.php?action=suggest_link&amp;title=Manipuler%20les%20param%C3%A8tres%20de%20configuration%20dans%20symfony&amp;url=http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html" title="blogtercimlap"><img src="http://www.mcherifi.org/wp-content/plugins/sociable/images/blogter.png" title="blogtercimlap" alt="blogtercimlap" class="sociable-hovers" /></a>


<br/><br/>
<p class="FacebookLikeButton"><fb:like href="http%3A%2F%2Fwww.mcherifi.org%2Fdeveloppement-web%2Fsymfony%2Fmanipuler-les-parametres-de-configuration-dans-symfony.html" layout="standard" show_faces="true" width="450" action="like" colorscheme="light"></fb:like></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mcherifi.org/developpement-web/symfony/manipuler-les-parametres-de-configuration-dans-symfony.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

