<?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>Amicalement Web - Astuces et Bons plans dans le développement web &#187; mysql</title>
	<atom:link href="http://www.amicalement-web.net/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.amicalement-web.net</link>
	<description>Astuces et bons plans d&#039;un web developpeur</description>
	<lastBuildDate>Thu, 03 Jun 2010 10:06:47 +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>Développement Web: les bons plans de la semaine #21</title>
		<link>http://www.amicalement-web.net/developpement-web-les-bons-plans-de-la-semaine-21/2009/11/02/</link>
		<comments>http://www.amicalement-web.net/developpement-web-les-bons-plans-de-la-semaine-21/2009/11/02/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 20:26:19 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Bons plans]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[icone]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[ie8]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://www.amicalement-web.net/?p=912</guid>
		<description><![CDATA[ Petit week end bien rempli et forcément petit report des bons plans de la semaine. Mais ce n&#8217;était qu&#8217;une question d&#8217;heure! Les voici les bons plans tant attendus avec un petit bonus à la fin


Des icones pour google map (via pborreli)
Oui parce que les icones par défaut, elles sont biens mais pas tops!
Un service [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.amicalement-web.net/wp-content/uploads/read-or-listen.png" alt="read-or-listen" title="read-or-listen" width="614" height="100" class="alignnone size-full wp-image-920" /> Petit week end bien rempli et forcément petit report des bons plans de la semaine. Mais ce n&#8217;était qu&#8217;une question d&#8217;heure! Les voici les bons plans tant attendus avec un petit bonus à la fin<br />
<span id="more-912"></span></p>
<ul>
<li><a  href="http://code.google.com/p/google-maps-icons/">Des icones pour google map</a> (via <a  href="http://twitter.com/pborreli">pborreli</a>)<br />
Oui parce que les icones par défaut, elles sont biens mais pas tops!</li>
<li><a  href="http://lloogg.com/">Un service de suivi de vos visiteurs en temps réel</a> (via <a  href="http://twitter.com/old_sound">old_sound</a>)<br />
Oui bon en gros, ca reste un tail -f access.log mais avec le décodeur en plus!</li>
<li><a  href="http://icones.pro/">Des jolies icones</a><br />
Un nouveau moteur de recherche avec quasi que des icones de qualité pour vos projets.</li>
<li><a  href="http://www.tripwiremagazine.com/tutorials/tutorials/jquery-and-general-javascript-tips-to-improve-your-code.html">Encore des astuces et optimisations pour jquery</a><br />
Et oui plus on l&#8217;utilise, plus on essaye de l&#8217;optimiser ce petit jquery.</li>
<li><a  href="http://www.thecssninja.com/css/real-text-rotation-with-css">Tourner vos textes en CSS&#8230; sous IE8</a><br />
Et oui voilà l&#8217;exception qui vient confirmer la règle, voici la propriété css3 que IE8 est le seul à interpréter! Ca devait être de ça dont parlait Microsoft quand ils nous ont vanté toute l&#8217;innovation de leur navigateur!</li>
<li><a  href="http://demo.tutorialzine.com/2009/10/google-wave-history-slider-jquery/demo.php">Reproduire le slider de l&#8217;historique google wave</a><br />
A peine sorti et voilà qu&#8217;on essaye déjà d&#8217;exporter en jquery ces bonnes idées. Ici le slider pour filtrer l&#8217;historique d&#8217;une liste de commentaire.</li>
<li><a  href="http://www.thegarvin.com/2009/10/28/clearer-code-with-jquery-micro-plugins.html">Codez en micro plugin jquery</a><br />
Une idée très intéressante qui consiste à implémenter vos lignes jquery de votre document.ready en micro plugin pour gagner en lisibilité et en maintenabilité</li>
<li><a  href="http://www.onderhond.com/tools/ie6fixer">IE6 fixer</a><br />
Voilà de quoi faciliter un peu votre debug IE6, grâce à cette génération de CSS qui permet de corriger les bugs les plus connus de ce dinosaure</li>
<li><a  href="http://www.phpclasses.org/browse/package/1136.html">Une classe PHP pour interfacer les thread PHP</a><br />
Tout est dans le titre ;)</li>
<li><a  href="http://till.klampaeckel.de/blog/archives/74-PHP-So-youd-like-to-migrate-from-MySQL-to-CouchDB-Part-I.html">Migrer de Mysql à COuchDB en PHP</a><br />
<a  href="http://twitter.com/jlecour">Jérémy</a> en parle beaucoup en ce moment. Ca méritait d&#8217;y jeter un oeil. Voici un tutorial pour appréhender la chose et comprendre ce qu&#8217;est CouchDB au passage.</li>
</ul>
<p>Et le bonus de la semaine chez l&#8217;ami Methylbro :<br />
<a  href="http://methylbro.titaxium.org/post/2009/11/01/concours-gagnez-le-livre-php5-avance">Gagner le livre php5 avance</a></p>
<p><small>Crédit photo: http://www.flickr.com/photos/chitrasudar/2721323275/</small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.amicalement-web.net/developpement-web-les-bons-plans-de-la-semaine-21/2009/11/02/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Symfony: Relation many-to-many sur la meme table avec Propel</title>
		<link>http://www.amicalement-web.net/symfony-relation-many-to-many-sur-la-meme-table-avec-propel/2009/06/24/</link>
		<comments>http://www.amicalement-web.net/symfony-relation-many-to-many-sur-la-meme-table-avec-propel/2009/06/24/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 10:36:51 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Astuces]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[propel]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://www.amicalement-web.net/?p=375</guid>
		<description><![CDATA[ Beaucoup de boulot pour cette courte semaine (je suis en week end, ce soir :D) du coup, je n&#8217;ai pas eu le temps de faire le billet Symfony du mardi! Ca tombait bien en même temps, car je n&#8217;avais pas énormément d&#8217;idées.
Finalement, j&#8217;ai trouvé un petit quelque chose pour subvenir à vos besoins de [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.amicalement-web.net/wp-content/uploads/system-search.png" alt="system-search" title="system-search" width="48" height="48" class="alignleft size-full wp-image-39" /> Beaucoup de boulot pour cette courte semaine (je suis en week end, ce soir :D) du coup, je n&#8217;ai pas eu le temps de faire le billet Symfony du mardi! Ca tombait bien en même temps, car je n&#8217;avais pas énormément d&#8217;idées.<br />
Finalement, j&#8217;ai trouvé un petit quelque chose pour subvenir à vos besoins de nouveautés permanents. On va parler d&#8217;une petite faiblesse dans Propel, que je n&#8217;ai pas encore pris le temps d&#8217;analyser dans toute sa profondeur mais qui reste assez gênant: La gestion des relations many-to-many sur une même table.<br />
<span id="more-375"></span><br />
En gros, une table d&#8217;association dont le couple serait deux clé étrangères sur la même table du genre:</p>

<div class="wp_syntax"><div class="code"><pre class="yaml" style="font-family:monospace;">  cross_selling:
    _attributes: { phpName: CrossSelling }
    pid: { type: SMALLINT, size: '5', primaryKey: true, required: true, foreignTable: produits, foreignReference: pid, onDelete: CASCADE, onUpdate: CASCADE }
    csid: { type: SMALLINT, size: '5', primaryKey: true, required: true, foreignTable: produits, foreignReference: pid, onDelete: CASCADE, onUpdate: CASCADE }</pre></div></div>

<p>Autant dans la partie model, aucun souci, on est capable de récupérer chacun des éléments par la table &laquo;&nbsp;Produits&nbsp;&raquo; (la table où pointe les 2 clés étrangères pour ceux qui se sont perdus en route), autant dans la partie form, aucune trace du widget pour matérialiser cette relation, rien, nada. Alors qu&#8217;au départ, si on définie notre relation, c&#8217;est qu&#8217;on en a un peu besoin en fait.</p>
<p>On va donc tâcher de combler ce vide, en rajoutant ce dont a besoin notre formulaire pour reproduire notre relation dans le fichier <code>lib/form/ProduitsForm.class.php</code></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> ProduitsForm <span style="color: #000000; font-weight: bold;">extends</span> BaseProduitsForm
<span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> configure<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    parent<span style="color: #339933;">::</span><span style="color: #004000;">configure</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// Ajout Cross Selling</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">widgetSchema</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cross_selling_list'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> sfWidgetFormPropelChoiceMany<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    	<span style="color: #0000ff;">'model'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Produits'</span>
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validatorSchema</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cross_selling_list'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> sfValidatorPropelChoiceMany<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'model'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Produits'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>On crée ensuite la méthode qui va permettre d&#8217;enregistrer le résultat de notre choix dans notre widget de liste (en fait, il suffit d&#8217;adapter le code généré pour une relation many-to-many qui fonctionne):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> saveCrossSellingList<span style="color: #009900;">&#40;</span><span style="color: #000088;">$con</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isValid</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      throw <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getErrorSchema</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">widgetSchema</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cross_selling_list'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">// somebody has unset this widget</span>
      <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$con</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$con</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getConnection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Criteria<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span>CrossSellingPeer<span style="color: #339933;">::</span><span style="color: #004000;">PID</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">object</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPrimaryKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    CrossSellingPeer<span style="color: #339933;">::</span><span style="color: #004000;">doDelete</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #339933;">,</span> <span style="color: #000088;">$con</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$values</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cross_selling_list'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$values</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$values</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$obj</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> CrossSelling<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setPid</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">object</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPrimaryKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCsid</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Puis on surcharge le doSave pour ajouter cette fonction:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">protected <span style="color: #000000; font-weight: bold;">function</span> doSave<span style="color: #009900;">&#40;</span><span style="color: #000088;">$con</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    parent<span style="color: #339933;">::</span><span style="color: #004000;">doSave</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$con</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">saveCrossSellingList</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$con</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>et pour finir on surcharge la méthode  updateDefaultsFromObject pour charger le résultat une fois sauvegardé:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> updateDefaultsFromObject<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    parent<span style="color: #339933;">::</span><span style="color: #004000;">updateDefaultsFromObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">widgetSchema</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cross_selling_list'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$values</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">object</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCrossSellingsRelatedByPid</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$obj</span><span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$values</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCsid</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDefault</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cross_selling_list'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$values</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Et voilà, Propel n&#8217;a qu&#8217;a bien se tenir, on peut se passer de lui! Je pense qu&#8217;avec un peu plus de temps, je me plongerai bien dans le détail pour voir où ça coince, à moins que j&#8217;ai loupé encore une fois un épisode.</p>
<p>Moralité, Doctrine vaincra?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.amicalement-web.net/symfony-relation-many-to-many-sur-la-meme-table-avec-propel/2009/06/24/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql, Propel et l&#8217;UTF8 sont dans un bateau</title>
		<link>http://www.amicalement-web.net/mysql-propel-utf8/2009/05/21/</link>
		<comments>http://www.amicalement-web.net/mysql-propel-utf8/2009/05/21/#comments</comments>
		<pubDate>Thu, 21 May 2009 13:35:37 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Astuces]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[propel]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://www.amicalement-web.net/?p=254</guid>
		<description><![CDATA[ Un gros souci que j&#8217;ai toujours eu lors de mes projets symfony c&#8217;est la capacité de dire à Propel que je veux ma base en UTF8, j&#8217;ai beau mettre UTF8 un peu partout, database.yml, schema.yml, propel.ini rien n&#8217;y fait, mon build-all créé mes tables en ISO. D&#8217;ailleurs un peu déçu que Jobeet chapitre 3 [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.amicalement-web.net/wp-content/uploads/edit-cut.png" alt="edit-cut" title="edit-cut" width="48" height="48" class="alignleft size-full wp-image-34" /> Un gros souci que j&#8217;ai toujours eu lors de mes projets symfony c&#8217;est la capacité de dire à Propel que je veux ma base en UTF8, j&#8217;ai beau mettre UTF8 un peu partout, database.yml, schema.yml, propel.ini rien n&#8217;y fait, mon build-all créé mes tables en ISO. D&#8217;ailleurs un peu déçu que <a  href="http://www.symfony-project.org/jobeet/1_2/Propel/en/03" class="extern">Jobeet chapitre 3</a> n&#8217;aborde pas le sujet.</p>
<p>J&#8217;ai donc tenté de voir du côté de Mysql, pour mettre ce dernier par défaut en utf8, mais là aussi, on a beau remplir le my.cnf de utf8 dans toutes les options, rien de concret ne se produit.</p>
<p>J&#8217;en été donc resté à devoir rajouter à la main, dans mon .sql généré par symfony, le fameux &laquo;&nbsp;DEFAUT CHARSET=UTF8&#8243;. Mais devoir le rajouter à chaque modification de mon schema, cela peut devenir pénible dans des projets de tests.</p>
<p>Et puis par hasard au détour d&#8217;une conversation sur mysql dans une mailing-list (mea culpa j&#8217;ai pas noté l&#8217;adresse) je suis enfin tombé sur quelque chose qui fonctionne! A la création de la table, écrire:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">DATABASE</span> mydb CHARACTER <span style="color: #990099; font-weight: bold;">SET</span> utf8 <span style="color: #CC0099; font-weight: bold;">COLLATE</span> utf8_general_ci</pre></div></div>

<p>Voilà, toutes les tables créés maintenant dans cette base seront en UTF8 par défaut.</p>
<p>Il y a sans doute mieux, mais pour l&#8217;instant je me contente de ça. Mais peut-être que quelqu&#8217;un a une meilleur solution? Comment gérez-vous vos tables en UTF8?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.amicalement-web.net/mysql-propel-utf8/2009/05/21/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
