<?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>GIS and Web Tricks &#187; MySql workbench</title>
	<atom:link href="http://www.bernawebdesign.ch/byteblog/tagged/mysql-workbench/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bernawebdesign.ch/byteblog</link>
	<description>Thougts and tricks on GIS, web development and FOSS</description>
	<lastBuildDate>Tue, 31 Jan 2012 23:52:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Adapting doctrineexport.grt.lua to symfony standards</title>
		<link>http://www.bernawebdesign.ch/byteblog/2009/09/17/adapting-doctrineexport-grt-lua-to-symfony-standards/</link>
		<comments>http://www.bernawebdesign.ch/byteblog/2009/09/17/adapting-doctrineexport-grt-lua-to-symfony-standards/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 14:35:43 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[Doctrine]]></category>
		<category><![CDATA[MySql workbench]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://www.bernawebdesign.ch/byteblog/2009/09/17/adapting-doctrineexport-grt-lua-to-symfony-standards/</guid>
		<description><![CDATA[Using Mysql workbench to visually design a data model for a symfony application is pretty cool. Thanks to the guys of http://code.google.com/p/mysql-workbench-doctrine-plugin/ you can export the model to a YAML file ready for Doctrine. the only problem I found using version 0.36 is that classes names are not in UpperCamelCase but in lowerCameCase and that [...]]]></description>
			<content:encoded><![CDATA[<p>Using Mysql workbench to visually design a data model for a symfony application is pretty cool. Thanks to the guys of <a href="http://code.google.com/p/mysql-workbench-doctrine-plugin/">http://code.google.com/p/mysql-workbench-doctrine-plugin/</a> you can export the model to a YAML file ready for Doctrine.<span id="more-99"></span><br />
the only problem I found using version 0.36 is that classes names are not in UpperCamelCase but in lowerCameCase and that if you have a table column that starts wit id (like idea) it gets cut to id (issue report: <a href="http://code.google.com/p/mysql-workbench-doctrine-plugin/issues/detail?id=15">http://code.google.com/p/mysql-workbench-doctrine-plugin/issues/detail?id=15</a>). so here my two  modifications of the script to behave the way I want.<br />
At the end of function buildTableName(s) add:</p>

<div class="wp_syntax"><div class="code"><pre class="lua" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #b1b100;">string.sub</span><span style="color: #66cc66;">&#40;</span>s, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">==</span> <span style="color: #ff0000;">'sf'</span> <span style="color: #b1b100;">or</span>  <span style="color: #b1b100;">string.sub</span><span style="color: #66cc66;">&#40;</span>s, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">==</span> <span style="color: #ff0000;">'Sf'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">then</span>
      <span style="color: #808080; font-style: italic;">-- same as lcfirst</span>
      s <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">string.lower</span><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">string.sub</span><span style="color: #66cc66;">&#40;</span>s, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> .. <span style="color: #b1b100;">string.sub</span><span style="color: #66cc66;">&#40;</span>s, <span style="color: #cc66cc;">3</span>, #s<span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">else</span>
      s <span style="color: #66cc66;">=</span> ucfirst<span style="color: #66cc66;">&#40;</span>s<span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">end</span>
    <span style="color: #b1b100;">return</span> s</pre></div></div>

<p>Comment out the content of the renameIdColumns function</p>

<div class="wp_syntax"><div class="code"><pre class="lua" style="font-family:monospace;"><span style="color: #b1b100;">function</span> renameIdColumns<span style="color: #66cc66;">&#40;</span>s<span style="color: #66cc66;">&#41;</span>
   <span style="color: #808080; font-style: italic;">-- s = string.gsub(s, &quot;(id%w+)&quot;, function(v)</span>
   <span style="color: #808080; font-style: italic;">--      return &quot;id&quot;</span>
   <span style="color: #808080; font-style: italic;">--    end)</span>
   <span style="color: #b1b100;">return</span> s
<span style="color: #b1b100;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bernawebdesign.ch/byteblog/2009/09/17/adapting-doctrineexport-grt-lua-to-symfony-standards/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

