<?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>Robert.Schöbel.net</title>
	<atom:link href="http://robert.xn--schbel-yxa.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://robert.xn--schbel-yxa.net</link>
	<description>Robert.Schöbel.net ist eine Sammlung von Beiträgen zu täglichen Progammierproblemen und Lösungen inkl. einiger meiner Referenzen</description>
	<lastBuildDate>Sun, 08 Jan 2012 14:13:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>Zeiterfassung TimeTracker Online</title>
		<link>http://robert.xn--schbel-yxa.net/2012/01/08/zeiterfassung-timetracker-online/</link>
		<comments>http://robert.xn--schbel-yxa.net/2012/01/08/zeiterfassung-timetracker-online/#comments</comments>
		<pubDate>Sun, 08 Jan 2012 14:09:11 +0000</pubDate>
		<dc:creator>Robert Schöbel</dc:creator>
				<category><![CDATA[usefull stuff]]></category>
		<category><![CDATA[Codeigniter 2]]></category>
		<category><![CDATA[Doctrine 2]]></category>
		<category><![CDATA[Zeiterfassung]]></category>

		<guid isPermaLink="false">http://robert.xn--schbel-yxa.net/?p=702</guid>
		<description><![CDATA[Die Zeiterfassung ist nun in die Betaphase gegangen und kann genutzt werden. Einfach kostenlos registrieren  und kostenlos die Arbeitszeit erfassen. mehr Informationen Startseite der Zeiterfassung]]></description>
			<content:encoded><![CDATA[<p>Die Zeiterfassung ist nun in die Betaphase gegangen und kann genutzt werden.</p>
<p>Einfach kostenlos registrieren  und kostenlos die Arbeitszeit erfassen.</p>
<p><a href="http://robert.xn--schbel-yxa.net/zeiterfassung/" target="_blank">mehr Informationen</a></p>
<p><a href="http://zeiterfassung.xn--schbel-yxa.net/" target="_blank">Startseite der Zeiterfassung</a></p>
]]></content:encoded>
			<wfw:commentRss>http://robert.xn--schbel-yxa.net/2012/01/08/zeiterfassung-timetracker-online/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Codeigniter 2 und Doctrine 2 HowTo 5/5</title>
		<link>http://robert.xn--schbel-yxa.net/2011/06/19/codeigniter-2-und-doctrine-2-howto-55/</link>
		<comments>http://robert.xn--schbel-yxa.net/2011/06/19/codeigniter-2-und-doctrine-2-howto-55/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 15:59:08 +0000</pubDate>
		<dc:creator>Robert Schöbel</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[usefull stuff]]></category>
		<category><![CDATA[Codeigniter 2]]></category>
		<category><![CDATA[Doctrine 2]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://robert.xn--schbel-yxa.net/?p=619</guid>
		<description><![CDATA[Ziel: Codeigniter 2 mit Doctrine 2 installieren Klasse erstellten und Datenbank anlegen Instanz eines Objektes erzeugen Containment Beziehung nutzen Containment Beziehung auslesen 5. Containment Elemente auslesen Das Ziel ist es, alle Workpackages mit ihren Tasks auszulesen. Workpackage1 Task1 Task2 Workpackage2 Task3 Task4 Dazu wird eine neuer Button im View start.php erzeugt &#60;?php echo form_open&#40;&#34;showdoctrine_main/list_packages_with_tasks&#34;&#41;; ?&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Ziel:</p>
<ol>
<li><a href="../?p=568" target="_blank">Codeigniter 2 mit Doctrine 2 installieren</a></li>
<li><a href="../?p=580" target="_blank">Klasse erstellten und Datenbank anlegen</a></li>
<li><a href="../2011/06/19/codeigniter-2-und-doctrine-2-howto-35/">Instanz eines Objektes erzeugen</a></li>
<li><a href="../2011/06/19/codeigniter-2-und-doctrine-2-howto-45/" target="_blank">Containment Beziehung nutzen</a></li>
<li><a href="../2011/06/19/codeigniter-2-und-doctrine-2-howto-55/">Containment Beziehung auslesen</a></li>
</ol>
<h3>5. Containment Elemente auslesen</h3>
<p>Das Ziel ist es, alle Workpackages mit ihren Tasks auszulesen.</p>
<ul>
<li>Workpackage1
<ul>
<li>Task1</li>
<li>Task2</li>
</ul>
</li>
<li>Workpackage2
<ul>
<li>Task3</li>
<li>Task4</li>
</ul>
</li>
</ul>
<p>Dazu wird eine neuer Button im View start.php erzeugt</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> form_open<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;showdoctrine_main/list_packages_with_tasks&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;input value=&quot;Workpackage auflisten&quot;  type=&quot;submit&quot;&gt;<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> form_close<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>Es muss zusätzlich eine neue Funktion im Controller erzeugt werden</p>
<p>Application/controllers/showdoctrine_main.php</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> list_packages_with_tasks<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$em</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doctrine</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">em</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$qb</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$em</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createQueryBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$qb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'w'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'t'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'models\workpackage'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'w'</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #339933;">-&gt;</span><span style="color: #004000;">join</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'w.task_collection'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'t'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$q</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$qb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQuery</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #666666; font-style: italic;">//$workpackage = $q-&gt;getResult();</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'workpackage_list'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$q</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getResult</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'list'</span><span style="color: #339933;">,</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Wie zu erkennen ist, muss noch ein View erzeugt werden</p>
<p>Application/view/list.php</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;!DOCTYPE html&gt;<br />
&lt;html lang=&quot;en&quot;&gt;<br />
&lt;head&gt;<br />
&lt;meta charset=&quot;utf-8&quot;&gt;<br />
&lt;title&gt;Welcome to CodeIgniter&lt;/title&gt;<br />
<br />
&lt;style type=&quot;text/css&quot;&gt;<br />
<br />
body {<br />
background-color: #fff;<br />
margin: 40px;<br />
font-family: Lucida Grande, Verdana, Sans-serif;<br />
font-size: 14px;<br />
color: #4F5155;<br />
}<br />
<br />
a {<br />
color: #003399;<br />
background-color: transparent;<br />
font-weight: normal;<br />
}<br />
<br />
h1 {<br />
color: #444;<br />
background-color: transparent;<br />
border-bottom: 1px solid #D0D0D0;<br />
font-size: 16px;<br />
font-weight: bold;<br />
margin: 24px 0 2px 0;<br />
padding: 5px 0 6px 0;<br />
}<br />
<br />
code {<br />
font-family: Monaco, Verdana, Sans-serif;<br />
font-size: 12px;<br />
background-color: #f9f9f9;<br />
border: 1px solid #D0D0D0;<br />
color: #002166;<br />
display: block;<br />
margin: 14px 0 14px 0;<br />
padding: 12px 10px 12px 10px;<br />
}<br />
<br />
&lt;/style&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
<br />
&lt;h1&gt;List&lt;/h1&gt;<br />
<br />
&lt;table&gt;<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$workpackage_list</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$workpackage</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span>  <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
<br />
&lt;tr&gt;<br />
&lt;td&gt;-&lt;/td&gt;<br />
&lt;td&gt;<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$workpackage</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTitle</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;/td&gt;<br />
&lt;td&gt;-&lt;/td&gt;<br />
&lt;/tr&gt;<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$workpackage</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTask_Collection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$task</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span>  <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;tr&gt;<br />
&lt;td&gt;-&lt;/td&gt;<br />
&lt;td&gt;-&lt;/td&gt;<br />
&lt;td&gt;<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$task</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTitle</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;/td&gt;<br />
&lt;/tr&gt;<br />
<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;/table&gt;<br />
<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> form_open<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;showdoctrine_main&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;input value=&quot;back&quot;  type=&quot;submit&quot;&gt;<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> form_close<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;/body&gt;<br />
&lt;/html&gt;</div></div>
<p>Damit die Methode $workpackage-&gt;getTask_Collection() ausgeführt werden kann, muss diese in die Klasse Workpackage integriert werden</p>
<p>Application/models/workpackage.php</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getTask_Collection<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">task_collection</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Jetzt kann die Ausgabe der  Liste im Browser getestet werden.</p>
]]></content:encoded>
			<wfw:commentRss>http://robert.xn--schbel-yxa.net/2011/06/19/codeigniter-2-und-doctrine-2-howto-55/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Codeigniter 2 und Doctrine 2 HowTo 4/5</title>
		<link>http://robert.xn--schbel-yxa.net/2011/06/19/codeigniter-2-und-doctrine-2-howto-45/</link>
		<comments>http://robert.xn--schbel-yxa.net/2011/06/19/codeigniter-2-und-doctrine-2-howto-45/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 15:46:06 +0000</pubDate>
		<dc:creator>Robert Schöbel</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[usefull stuff]]></category>
		<category><![CDATA[Codeigniter 2]]></category>
		<category><![CDATA[Doctrine 2]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://robert.xn--schbel-yxa.net/?p=614</guid>
		<description><![CDATA[Ziele Codeigniter 2 mit Doctrine 2 installieren Klasse erstellen und Datenbank anlegen Instanz einer Klasse erzeugen Containment Beziehung nutzen Containment Beziehung auslesen 4. Containment Beziehung nutzen Die workpackage_id in der Tabelle Task ist aktuell noch Null. In der Datenbank ist das Feld auch auf Null = true gesetzt. Ziel: in der Datenbank muss &#8220;workpackage_id&#8221; = [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Ziele</strong></p>
<ol>
<li><a href="../?p=568" target="_blank">Codeigniter 2 mit Doctrine 2 installieren</a></li>
<li><a href="../?p=580" target="_blank">Klasse erstellen und Datenbank anlegen</a></li>
<li><a href="../2011/06/19/codeigniter-2-und-doctrine-2-howto-35/">Instanz einer Klasse erzeugen</a></li>
<li><a href="../2011/06/19/codeigniter-2-und-doctrine-2-howto-45/" target="_blank">Containment Beziehung nutzen</a></li>
<li><a href="../2011/06/19/codeigniter-2-und-doctrine-2-howto-55/">Containment Beziehung auslesen</a></li>
</ol>
<h3>4. Containment Beziehung nutzen</h3>
<p>Die workpackage_id in der Tabelle Task ist aktuell noch Null.</p>
<p>In der Datenbank ist das Feld auch auf Null = true gesetzt.</p>
<p>Ziel: in der Datenbank muss &#8220;workpackage_id&#8221; = &#8220;not null&#8221; gelten.</p>
<p>Änderung in der Datei application/models/task.php</p>
<p>&#8211; nullable=false</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009933; font-style: italic;">/**<br />
* @ManyToOne(targetEntity=&quot;Workpackage&quot;, inversedBy=&quot;task_collection&quot;)<br />
* @JoinColumn(name=&quot;workpackage_id&quot;, referencedColumnName=&quot;id&quot;, nullable=false)<br />
*/</span><br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$workpackage</span><span style="color: #339933;">;</span></div></div>
<p>Update des Schemas über die Konsole</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">X<span style="color: #339933;">:</span>\xampp\php\php<span style="color: #339933;">.</span>exe <span style="color: #339933;">-</span>f <span style="color: #0000ff;">&quot;X:<span style="color: #660099; font-weight: bold;">\xa</span>mpp\htdocs\showdoctrine\application\doctrine_init.php&quot;</span> orm<span style="color: #339933;">:</span>schema<span style="color: #339933;">-</span>tool<span style="color: #339933;">:</span>update <span style="color: #339933;">--</span>force</div></div>
<p>Erneutes ausführen des &#8220;add Task&#8221; Buttons ruft jetzt einen Fehler hervor</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'workpackage_id' cannot be null' ......</div></div>
<p>Das passt!</p>
<p>Jetzt muss als erstes ein Workpackage angelegt werden und dann ein Task mit entsprechender Workpackage Id</p>
<p>Dazu muss im Model des Task folgendes ergänzt werden</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">/* Workpackage */</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setWorkpackage<span style="color: #009900;">&#40;</span><span style="color: #000088;">$workpackage</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">workpackage</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$workpackage</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getWorkpackage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">workpackage</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Der Controller wird ebenfalls angepasst (Funktion &#8220;add_task&#8221; wird erweitert)</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> add_task<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<br />
<span style="color: #666666; font-style: italic;">/* doctrine entity manager */</span><br />
<span style="color: #000088;">$em</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doctrine</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">em</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Workpackage anlegen</span><br />
<span style="color: #000088;">$workpackage</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \models\Workpackage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$workpackage</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;package&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$em</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">persist</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$workpackage</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Task anlegen</span><br />
<span style="color: #000088;">$task</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \models\Task<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$task</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;first&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #666666; font-style: italic;">// Task mit Workpackage ID verknüpfen</span><br />
<span style="color: #000088;">$task</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setWorkpackage</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$workpackage</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$em</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">persist</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$task</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #666666; font-style: italic;">//flush ist ähnlich zur save Funktion, es führt save für alle nicht gespeicherten records aus</span><br />
<span style="color: #000088;">$em</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'start'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Das Ausführen über den Button &#8220;add_task&#8221; erstellt jetzt ein Workpackage und einen Task in der Datenbank.</p>
<p>Dem Task wird die  Workpackage Id zugewiesen.</p>
]]></content:encoded>
			<wfw:commentRss>http://robert.xn--schbel-yxa.net/2011/06/19/codeigniter-2-und-doctrine-2-howto-45/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Codeigniter 2 und Doctrine 2 HowTo 3/5</title>
		<link>http://robert.xn--schbel-yxa.net/2011/06/19/codeigniter-2-und-doctrine-2-howto-35/</link>
		<comments>http://robert.xn--schbel-yxa.net/2011/06/19/codeigniter-2-und-doctrine-2-howto-35/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 15:38:50 +0000</pubDate>
		<dc:creator>Robert Schöbel</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[usefull stuff]]></category>
		<category><![CDATA[Codeigniter 2]]></category>
		<category><![CDATA[Doctrine 2]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://robert.xn--schbel-yxa.net/?p=610</guid>
		<description><![CDATA[Ziel: Codeigniter 2 mit Doctrine 2 installieren Klasse erstellen und Datenbank anlegen Instanz einer Klasse erzeugen Containment Beziehung nutzen Containment Beziehung auslesen 3. Instanz einer Klasse erzeugen Ziel:  Anlegen einer Aufgabe: * Controller: showdoctrine_main.php * Viewer:  start.php Anpassen des Start-Controllers &#8211; Ordner &#8220;Application/config/routes.php&#8221; $route&#91;'default_controller'&#93; = &#34;showdoctrine_main&#34;; Controller angelegen: Controller: application/controller/showdoctrine_main.php &#60;?php if &#40; ! defined&#40;'BASEPATH'&#41;&#41; [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Ziel:</strong></p>
<ol>
<li><a href="../?p=568" target="_blank">Codeigniter 2 mit Doctrine 2 installieren</a></li>
<li><a href="../?p=580" target="_blank">Klasse erstellen und Datenbank anlegen</a></li>
<li><a href="../2011/06/19/codeigniter-2-und-doctrine-2-howto-35/">Instanz einer Klasse erzeugen</a></li>
<li><a href="../2011/06/19/codeigniter-2-und-doctrine-2-howto-45/" target="_blank">Containment Beziehung nutzen</a></li>
<li><a href="../2011/06/19/codeigniter-2-und-doctrine-2-howto-55/">Containment Beziehung auslesen</a></li>
</ol>
<p><strong>3. Instanz einer Klasse erzeugen<br />
</strong></p>
<p>Ziel:  Anlegen einer Aufgabe:</p>
<p>* Controller: showdoctrine_main.php<br />
* Viewer:  start.php</p>
<p>Anpassen des Start-Controllers &#8211; Ordner &#8220;Application/config/routes.php&#8221;</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$route</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default_controller'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;showdoctrine_main&quot;</span><span style="color: #339933;">;</span></div></div>
<p>Controller angelegen:</p>
<p>Controller: application/controller/showdoctrine_main.php</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'BASEPATH'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No direct script access allowed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> models\Task<span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">class</span> Showdoctrine_main <span style="color: #000000; font-weight: bold;">extends</span> CI_Controller <span style="color: #009900;">&#123;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> add_task<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<br />
<span style="color: #000088;">$task</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \models\Task<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$task</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;first&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$em</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">doctrine</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">em</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$em</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">persist</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$task</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$em</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'start'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> index<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'start'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>Viewer anlegen:</p>
<p>application/view/start.php</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;!DOCTYPE html&gt;<br />
&lt;html lang=&quot;en&quot;&gt;<br />
&lt;head&gt;<br />
&lt;meta charset=&quot;utf-8&quot;&gt;<br />
&lt;title&gt;Welcome to CodeIgniter&lt;/title&gt;<br />
<br />
&lt;style type=&quot;text/css&quot;&gt;<br />
<br />
body {<br />
background-color: #fff;<br />
margin: 40px;<br />
font-family: Lucida Grande, Verdana, Sans-serif;<br />
font-size: 14px;<br />
color: #4F5155;<br />
}<br />
<br />
a {<br />
color: #003399;<br />
background-color: transparent;<br />
font-weight: normal;<br />
}<br />
<br />
h1 {<br />
color: #444;<br />
background-color: transparent;<br />
border-bottom: 1px solid #D0D0D0;<br />
font-size: 16px;<br />
font-weight: bold;<br />
margin: 24px 0 2px 0;<br />
padding: 5px 0 6px 0;<br />
}<br />
<br />
code {<br />
font-family: Monaco, Verdana, Sans-serif;<br />
font-size: 12px;<br />
background-color: #f9f9f9;<br />
border: 1px solid #D0D0D0;<br />
color: #002166;<br />
display: block;<br />
margin: 14px 0 14px 0;<br />
padding: 12px 10px 12px 10px;<br />
}<br />
<br />
&lt;/style&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
<br />
&lt;h1&gt;Welcome to ShowDoctrine&lt;/h1&gt;<br />
<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> form_open<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;showdoctrine_main/add_task&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;input value=&quot;Task anlagen&quot;  type=&quot;submit&quot;&gt;<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> form_close<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&lt;/body&gt;<br />
&lt;/html&gt;</div></div>
<p>wird auf  &#8220;Task anlegen&#8221; geklickt, wird ein neuer Task in der Tabelle Task erstellt (nachfolgende Zusatzinformation beachten).</p>
<p><strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</strong></p>
<p><strong>Zusatzinformation zum Namespace:</strong></p>
<p>Doctrine muss als Bibliothek automatisch geladen werden</p>
<p>Datei: application/config/autoload.php</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$autoload</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'libraries'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'doctrine'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>Ein Fehler der darauf hindeutet, dass die Bibliothek noch nicht geladen ist lauted:</p>
<p>Class &#8216;models\Task&#8217; not found</p>
<p>bezogen auf eine Zeile im  Code an der &#8220;$task = new \models\Task();&#8221; verwendet wird</p>
<p><strong>Zusatzinformation zum Formhelper</strong></p>
<p>Um in einer View-Datei mit dem Form-Helper zu arbeiten, muss dieser unter &#8220;Appclication/config/autoload.php&#8221; aktiviert werden.</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$autoload</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'helper'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'form'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p><strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://robert.xn--schbel-yxa.net/2011/06/19/codeigniter-2-und-doctrine-2-howto-35/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Codeigniter 2 und Doctrine 2 HowTo 2/5</title>
		<link>http://robert.xn--schbel-yxa.net/2011/04/09/codeigniter-2-und-doctrine-2-howto-2-5/</link>
		<comments>http://robert.xn--schbel-yxa.net/2011/04/09/codeigniter-2-und-doctrine-2-howto-2-5/#comments</comments>
		<pubDate>Sat, 09 Apr 2011 10:27:49 +0000</pubDate>
		<dc:creator>Robert Schöbel</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[usefull stuff]]></category>
		<category><![CDATA[Codeigniter 2]]></category>
		<category><![CDATA[Doctrine 2]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://robert.xn--schbel-yxa.net/?p=580</guid>
		<description><![CDATA[Ziel: Codeigniter 2 mit Doctrine 2 installieren Klasse erstellen und Datenbank anlegen Instanz einer Klasse erzeugen Containment Beziehung nutzen Containment Beziehung auslesen 2. Klasse erstellen und Datenbank anlegen Ein einfaches Klassenmodell Zwei Klassen aus dem Bereich Projektmanagement: Workpackage (Arbeitspakete) Task (Aufgaben) Die zwei Klassen werden unter dem Ordner &#8220;Application/models/&#8221; angelegt. task.php namespace models; /** * [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Ziel:</strong></p>
<ol>
<li><a href="../?p=568" target="_blank">Codeigniter 2 mit Doctrine 2 installieren</a></li>
<li><a href="../?p=580" target="_blank">Klasse erstellen und Datenbank anlegen</a></li>
<li><a href="../2011/06/19/codeigniter-2-und-doctrine-2-howto-35/">Instanz einer Klasse erzeugen</a></li>
<li><a href="../2011/06/19/codeigniter-2-und-doctrine-2-howto-45/" target="_blank">Containment Beziehung nutzen</a></li>
<li><a href="../2011/06/19/codeigniter-2-und-doctrine-2-howto-55/">Containment Beziehung auslesen</a></li>
</ol>
<p><strong>2. Klasse erstellen und Datenbank anlegen</strong></p>
<p>Ein einfaches Klassenmodell</p>
<p>Zwei Klassen aus dem Bereich Projektmanagement:</p>
<ul>
<li>Workpackage (Arbeitspakete)</li>
<li>Task (Aufgaben)</li>
</ul>
<p>Die zwei Klassen werden unter dem Ordner &#8220;Application/models/&#8221; angelegt.</p>
<p>task.php</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">namespace</span> models<span style="color: #339933;">;</span><br />
<br />
<span style="color: #009933; font-style: italic;">/**<br />
* @Entity @HasLifecycleCallbacks<br />
* @Table(name=&quot;task&quot;)<br />
*/</span><br />
<span style="color: #000000; font-weight: bold;">class</span> Task <span style="color: #009900;">&#123;</span><br />
<br />
<span style="color: #009933; font-style: italic;">/**<br />
* @Id<br />
* @Column(type=&quot;integer&quot;, nullable=false)<br />
* @GeneratedValue(strategy=&quot;AUTO&quot;)<br />
*/</span><br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009933; font-style: italic;">/**<br />
* @Column(type=&quot;string&quot;, length=512, nullable=true)<br />
*/</span><br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$comment</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009933; font-style: italic;">/**<br />
* @Column(type=&quot;string&quot;, length=512, nullable=true)<br />
*/</span><br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009933; font-style: italic;">/**<br />
* @Column(type=&quot;decimal&quot;,  nullable=true)<br />
*/</span><br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$accounting</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009933; font-style: italic;">/**<br />
* @ManyToOne(targetEntity=&quot;Workpackage&quot;, inversedBy=&quot;task_collection&quot;)<br />
* @JoinColumn(name=&quot;workpackage_id&quot;, referencedColumnName=&quot;id&quot;)<br />
*/</span><br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$workpackage</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getTitle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setTitle<span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></div>
<p>workpackage.php</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">namespace</span> models<span style="color: #339933;">;</span><br />
<br />
<span style="color: #009933; font-style: italic;">/**<br />
* @Entity<br />
* @Table(name=&quot;workpackage&quot;)<br />
*/</span><br />
<br />
<span style="color: #000000; font-weight: bold;">class</span> Workpackage <span style="color: #009900;">&#123;</span><br />
<br />
<span style="color: #009933; font-style: italic;">/**<br />
* @Id<br />
* @Column(type=&quot;integer&quot;, nullable=false)<br />
* @GeneratedValue(strategy=&quot;AUTO&quot;)<br />
*/</span><br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009933; font-style: italic;">/**<br />
* @Column(type=&quot;string&quot;, length=32, nullable=false)<br />
*/</span><br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009933; font-style: italic;">/**<br />
* @OneToMany(targetEntity=&quot;Task&quot;, mappedBy=&quot;Workpackage&quot;)<br />
*/</span><br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$task_collection</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">task_collection</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \Doctrine\Common\Collections\ArrayCollection<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getTitle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setTitle<span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Anlegen der Datenbank</p>
<p>Datenbankname: test_db</p>
<p>Ist die Datenbank angelegt, können die Tabellen über das Doctrine Script angelegt werden.</p>
<p>Konsole starten und das Schema erstellen bzw. updaten:</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">X<span style="color: #339933;">:</span>\xampp\php\php<span style="color: #339933;">.</span>exe <span style="color: #339933;">-</span>f <span style="color: #0000ff;">&quot;X:<span style="color: #660099; font-weight: bold;">\xa</span>mpp\htdocs\showdoctrine\application\doctrine_init.php&quot;</span> orm<span style="color: #339933;">:</span>schema<span style="color: #339933;">-</span>tool<span style="color: #339933;">:</span>update <span style="color: #339933;">--</span>force</div></div>
<p>Durch das Script werden zwei Tabellen (Workpackage, Task) angelegt.</p>
<p>für die Tabelle Task wird automatisch die Spalte workspace_id die als Referenz erstellt.</p>
]]></content:encoded>
			<wfw:commentRss>http://robert.xn--schbel-yxa.net/2011/04/09/codeigniter-2-und-doctrine-2-howto-2-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Codeigniter 2 und Doctrine 2 HowTo 1/5</title>
		<link>http://robert.xn--schbel-yxa.net/2011/04/08/codeigniter-2-und-doctrine-2-howto/</link>
		<comments>http://robert.xn--schbel-yxa.net/2011/04/08/codeigniter-2-und-doctrine-2-howto/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 19:49:47 +0000</pubDate>
		<dc:creator>Robert Schöbel</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[usefull stuff]]></category>
		<category><![CDATA[Codeigniter 2]]></category>
		<category><![CDATA[Doctrine 2]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://robert.xn--schbel-yxa.net/?p=568</guid>
		<description><![CDATA[Ziel: Codeigniter 2 mit Doctrine 2 installieren Klasse erstellen und Datenbank anlegen Instanz einer Klasse erzeugen Containment Beziehung nutzen Containment Beziehung auslesen 1. Codeigniter 2 mit Doctrine 2 installieren &#8212;&#8212;&#8212;&#8212;- Info: Die Installation und der Code für die Doctrine integration stammen ursprünglich von dieser Seite (Installation sehr ausführlich erklärt): http://wildlyinaccurate.com/integrating-doctrine-2-with-codeigniter-2/ &#8212;&#8212;&#8212;&#8212;- Nach dem Download von [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Ziel:</strong></p>
<ol>
<li><a href="http://robert.xn--schbel-yxa.net/?p=568" target="_blank">Codeigniter 2 mit Doctrine 2 installieren</a></li>
<li><a href="http://robert.xn--schbel-yxa.net/?p=580" target="_blank">Klasse erstellen und Datenbank anlegen</a></li>
<li><a href="http://robert.xn--schbel-yxa.net/2011/06/19/codeigniter-2-und-doctrine-2-howto-35/">Instanz einer Klasse erzeugen</a></li>
<li><a href="http://robert.xn--schbel-yxa.net/2011/06/19/codeigniter-2-und-doctrine-2-howto-45/" target="_blank">Containment Beziehung nutzen</a></li>
<li><a href="http://robert.xn--schbel-yxa.net/2011/06/19/codeigniter-2-und-doctrine-2-howto-55/">Containment Beziehung auslesen</a></li>
</ol>
<p><strong>1. Codeigniter 2 mit Doctrine 2 installieren</strong></p>
<p>&#8212;&#8212;&#8212;&#8212;-</p>
<p><em>Info: Die Installation und der Code für die Doctrine integration stammen ursprünglich von dieser Seite (Installation sehr ausführlich erklärt):</em></p>
<p><a href="http://wildlyinaccurate.com/integrating-doctrine-2-with-codeigniter-2/" target="_blank"><em>http://wildlyinaccurate.com/integrating-doctrine-2-with-codeigniter-2/</em></a></p>
<p>&#8212;&#8212;&#8212;&#8212;-</p>
<p>Nach dem Download von Codeigniter Version 2.0.2 ergeben sich zwei Ordner:</p>
<p>&#8220;system&#8221; und &#8220;application&#8221;.</p>
<p>Zusätzlich wird <a href="http://www.doctrine-project.org/projects/orm/2.0/download/2.0.4" target="_blank">Doctrine</a> 2.0.4 geladen.</p>
<p>Entpackt ergeben sich die Ordner &#8220;bin&#8221; und &#8220;doctrine&#8221;.</p>
<p>Der &#8220;doctrine&#8221; Ordner wird komplett ins Codeigniter Verzeichnis &#8220;/application/libraries&#8221; kopiert.</p>
<p>Zur Verwendung von Doctrine 2 fehlt eine Klasse mit die mit Codeigniter genutzt werden kann.</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #666666; font-style: italic;">/* use with<br />
* $em = $this-&gt;doctrine-&gt;em;<br />
*/</span><br />
<br />
<span style="color: #000000; font-weight: bold;">use</span> Doctrine\Common\ClassLoader<span style="color: #339933;">,</span><br />
Doctrine\ORM\Configuration<span style="color: #339933;">,</span><br />
Doctrine\ORM\EntityManager<span style="color: #339933;">,</span><br />
Doctrine\Common\Cache\ArrayCache<span style="color: #339933;">,</span><br />
Doctrine\DBAL\Logging\EchoSqlLogger<span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">class</span> Doctrine <span style="color: #009900;">&#123;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$em</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">// load database configuration from CodeIgniter</span><br />
<span style="color: #b1b100;">require_once</span> APPPATH<span style="color: #339933;">.</span><span style="color: #0000ff;">'config/database.php'</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Set up class loading. You could use different autoloaders, provided by your favorite framework,</span><br />
<span style="color: #666666; font-style: italic;">// if you want to.</span><br />
<span style="color: #b1b100;">require_once</span> APPPATH<span style="color: #339933;">.</span><span style="color: #0000ff;">'libraries/Doctrine/Common/ClassLoader.php'</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$doctrineClassLoader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ClassLoader<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Doctrine'</span><span style="color: #339933;">,</span>  APPPATH<span style="color: #339933;">.</span><span style="color: #0000ff;">'libraries'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$doctrineClassLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$entitiesClassLoader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ClassLoader<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'models'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/rtrim"><span style="color: #990000;">rtrim</span></a><span style="color: #009900;">&#40;</span>APPPATH<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$entitiesClassLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$proxiesClassLoader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ClassLoader<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Proxies'</span><span style="color: #339933;">,</span> APPPATH<span style="color: #339933;">.</span><span style="color: #0000ff;">'models/proxies'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$proxiesClassLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Set up caches</span><br />
<span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Configuration<span style="color: #339933;">;</span><br />
<span style="color: #000088;">$cache</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayCache<span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMetadataCacheImpl</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setQueryCacheImpl</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Proxy configuration</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setProxyDir</span><span style="color: #009900;">&#40;</span>APPPATH<span style="color: #339933;">.</span><span style="color: #0000ff;">'/models/proxies'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setProxyNamespace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Proxies'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Set up logger</span><br />
<span style="color: #000088;">$logger</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> EchoSqlLogger<span style="color: #339933;">;</span><br />
<span style="color: #000088;">$log</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$log</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setSqlLogger</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$logger</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAutoGenerateProxyClasses</span><span style="color: #009900;">&#40;</span> <span style="color: #009900; font-weight: bold;">TRUE</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Database connection information</span><br />
<span style="color: #000088;">$connectionOptions</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
<span style="color: #0000ff;">'driver'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$db</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dbdriver'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><br />
<span style="color: #0000ff;">'user'</span> <span style="color: #339933;">=&gt;</span>     <span style="color: #000088;">$db</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'username'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><br />
<span style="color: #0000ff;">'password'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$db</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><br />
<span style="color: #0000ff;">'host'</span> <span style="color: #339933;">=&gt;</span>     <span style="color: #000088;">$db</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hostname'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><br />
<span style="color: #0000ff;">'dbname'</span> <span style="color: #339933;">=&gt;</span>   <span style="color: #000088;">$db</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'database'</span><span style="color: #009900;">&#93;</span><br />
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Mapping Configuration</span><br />
<span style="color: #666666; font-style: italic;">//      $driverImpl = $config-&gt;newDefaultAnnotationDriver(APPPATH.'/application/models');</span><br />
<span style="color: #666666; font-style: italic;">//      $config-&gt;setMetadataDriverImpl($driverImpl);</span><br />
<span style="color: #666666; font-style: italic;">// Set up driver</span><br />
<span style="color: #000088;">$Doctrine_AnnotationReader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \Doctrine\Common\Annotations\AnnotationReader<span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$Doctrine_AnnotationReader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDefaultAnnotationNamespace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Doctrine\ORM\Mapping\');<br />
$driver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($Doctrine_AnnotationReader, APPPATH.'</span>models<span style="color: #0000ff;">');<br />
$config-&gt;setMetadataDriverImpl($driver);<br />
<br />
// Create EntityManager<br />
$this-&gt;em = EntityManager::create($connectionOptions, $config);<br />
}<br />
}<br />
?&gt;</span></div></div>
<p>Dieser Code wird in einer Datei gespeichert (doctrine.php) und im Ordner &#8220;application/libraries/&#8221; abgelegt.</p>
<p>Zusätzlich fehlt eine Datei zum Initiieren der Tabellen in der Datenbanken.</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<br />
<a href="http://www.php.net/chdir"><span style="color: #990000;">chdir</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/dirname"><span style="color: #990000;">dirname</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/libraries'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'Doctrine/Common/ClassLoader.php'</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$classLoader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \Doctrine\Common\ClassLoader<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Doctrine'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$classLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$classLoader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \Doctrine\Common\ClassLoader<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Symfony'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Doctrine'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$classLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$configFile</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'../cli_config.php'</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$helperSet</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/file_exists"><span style="color: #990000;">file_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$configFile</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <a href="http://www.php.net/is_readable"><span style="color: #990000;">is_readable</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$configFile</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<a href="http://www.php.net/trigger_error"><span style="color: #990000;">trigger_error</span></a><span style="color: #009900;">&#40;</span><br />
<span style="color: #0000ff;">'Configuration file ['</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$configFile</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'] does not have read permission.'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">E_ERROR</span><br />
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #b1b100;">require</span> <span style="color: #000088;">$configFile</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$GLOBALS</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$helperSetCandidate</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$helperSetCandidate</span> instanceof \Symfony\Component\Console\Helper\HelperSet<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$helperSet</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$helperSetCandidate</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000088;">$helperSet</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$helperSet</span><span style="color: #009900;">&#41;</span> ?<span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">new</span> \Symfony\Component\Console\Helper\HelperSet<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$cli</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \Symfony\Component\Console\Application<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Doctrine Command Line Interface'</span><span style="color: #339933;">,</span> Doctrine\ORM\Version<span style="color: #339933;">::</span><span style="color: #004000;">VERSION</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$cli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCatchExceptions</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$cli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setHelperSet</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$helperSet</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$cli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addCommands</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
<span style="color: #666666; font-style: italic;">// DBAL Commands</span><br />
<span style="color: #000000; font-weight: bold;">new</span> \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
<span style="color: #000000; font-weight: bold;">new</span> \Doctrine\DBAL\Tools\Console\Command\ImportCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
<br />
<span style="color: #666666; font-style: italic;">// ORM Commands</span><br />
<span style="color: #000000; font-weight: bold;">new</span> \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
<span style="color: #000000; font-weight: bold;">new</span> \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
<span style="color: #000000; font-weight: bold;">new</span> \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
<span style="color: #000000; font-weight: bold;">new</span> \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
<span style="color: #000000; font-weight: bold;">new</span> \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
<span style="color: #000000; font-weight: bold;">new</span> \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
<span style="color: #000000; font-weight: bold;">new</span> \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
<span style="color: #000000; font-weight: bold;">new</span> \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
<span style="color: #000000; font-weight: bold;">new</span> \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
<span style="color: #000000; font-weight: bold;">new</span> \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
<span style="color: #000000; font-weight: bold;">new</span> \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
<span style="color: #000000; font-weight: bold;">new</span> \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
<span style="color: #000000; font-weight: bold;">new</span> \Doctrine\ORM\Tools\Console\Command\RunDqlCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
<span style="color: #000000; font-weight: bold;">new</span> \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
<br />
<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$cli</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">run</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>Dieser Code wird als Datei doctrine_init.php  unter &#8220;application/&#8221; abgelegt.</p>
<p>Die letzte Datei für Doctrine 2 ist die Konfiguration.</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<br />
<span style="color: #000000; font-weight: bold;">use</span> Doctrine\Common\ClassLoader<span style="color: #339933;">,</span><br />
Doctrine\ORM\Configuration<span style="color: #339933;">,</span><br />
Doctrine\ORM\EntityManager<span style="color: #339933;">,</span><br />
Doctrine\Common\Cache\ArrayCache<span style="color: #339933;">,</span><br />
Doctrine\DBAL\Logging\EchoSqlLogger<span style="color: #339933;">;</span><br />
<br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'BASEPATH'</span><span style="color: #339933;">,</span> __DIR__ <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/../system/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">require_once</span> __DIR__ <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/config/database.php'</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">require_once</span> __DIR__ <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/libraries/Doctrine/Common/ClassLoader.php'</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$doctrineClassLoader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ClassLoader<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Doctrine'</span><span style="color: #339933;">,</span>  __DIR__<span style="color: #339933;">.</span><span style="color: #0000ff;">'libraries'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$doctrineClassLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$entitiesClassLoader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ClassLoader<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'models'</span><span style="color: #339933;">,</span> __DIR__<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$entitiesClassLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$proxiesClassLoader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ClassLoader<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Proxies'</span><span style="color: #339933;">,</span> __DIR__<span style="color: #339933;">.</span><span style="color: #0000ff;">'models/proxies'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$proxiesClassLoader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \Doctrine\ORM\Configuration<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setMetadataCacheImpl</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> \Doctrine\Common\Cache\ArrayCache<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setProxyDir</span><span style="color: #009900;">&#40;</span>__DIR__ <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/Proxies'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setProxyNamespace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Proxies'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$cache</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayCache<span style="color: #339933;">;</span><br />
<span style="color: #666666; font-style: italic;">// Set up driver</span><br />
<span style="color: #000088;">$Doctrine_AnnotationReader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> \Doctrine\Common\Annotations\AnnotationReader<span style="color: #009900;">&#40;</span><span style="color: #000088;">$cache</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$Doctrine_AnnotationReader</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDefaultAnnotationNamespace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Doctrine\ORM\Mapping\');<br />
$driver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($Doctrine_AnnotationReader, realpath('</span><span style="color: #339933;">../</span>models<span style="color: #0000ff;">'));<br />
$config-&gt;setMetadataDriverImpl($driver);<br />
<br />
// Database connection information<br />
$connectionOptions = array(<br />
'</span>driver<span style="color: #0000ff;">' =&gt; '</span>pdo_mysql<span style="color: #0000ff;">',<br />
'</span>user<span style="color: #0000ff;">' =&gt;     $db['</span><span style="color: #b1b100;">default</span><span style="color: #0000ff;">']['</span>username<span style="color: #0000ff;">'],<br />
'</span>password<span style="color: #0000ff;">' =&gt; $db['</span><span style="color: #b1b100;">default</span><span style="color: #0000ff;">']['</span>password<span style="color: #0000ff;">'],<br />
'</span>host<span style="color: #0000ff;">' =&gt;     $db['</span><span style="color: #b1b100;">default</span><span style="color: #0000ff;">']['</span>hostname<span style="color: #0000ff;">'],<br />
'</span>dbname<span style="color: #0000ff;">' =&gt;   $db['</span><span style="color: #b1b100;">default</span><span style="color: #0000ff;">']['</span>database<span style="color: #0000ff;">']<br />
);<br />
<br />
$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);<br />
<br />
$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(<br />
'</span>db<span style="color: #0000ff;">' =&gt; new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em-&gt;getConnection()),<br />
'</span>em<span style="color: #0000ff;">' =&gt; new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)<br />
));<br />
?&gt;</span></div></div>
<p>Der Code wird als &#8220;cli_config.php&#8221; unter dem Ordner &#8220;application/&#8221; abgelegt.<strong> </strong></p>
<p>Mit den drei zusätzlichen Dateien sind alle Dateien für Doctrine 2 vorhanden<strong>.</strong></p>
<p>Es folgt die Konfiguration in Codeigniter<strong> </strong></p>
<p>Die Datei database.php muss im Ordner &#8220;application/config&#8221; konfiguriert werden.</p>
<p><strong><a rel="attachment wp-att-571" href="http://robert.xn--schbel-yxa.net/2011/04/08/codeigniter-2-und-doctrine-2-howto/db/" target="_blank"><img class="alignnone size-thumbnail wp-image-571" title="db" src="http://robert.xn--schbel-yxa.net/wp-content/uploads/2011/04/db-150x150.png" alt="" width="150" height="150" /></a></strong></p>
<p>Natürlich muss jetzt noch die &#8220;base_url&#8221; in der &#8220;application/config/config.php&#8221; Datei eingestellt werden.<strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://robert.xn--schbel-yxa.net/2011/04/08/codeigniter-2-und-doctrine-2-howto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter on Facebook</title>
		<link>http://robert.xn--schbel-yxa.net/2011/03/25/twitter-on-facebook/</link>
		<comments>http://robert.xn--schbel-yxa.net/2011/03/25/twitter-on-facebook/#comments</comments>
		<pubDate>Fri, 25 Mar 2011 16:51:19 +0000</pubDate>
		<dc:creator>Robert Schöbel</dc:creator>
				<category><![CDATA[usefull stuff]]></category>

		<guid isPermaLink="false">http://robert.xn--schbel-yxa.net/?p=543</guid>
		<description><![CDATA[Um Tweets einfach auf Facebook zu posten, kann folgende Anwendung verwendet werden: http://apps.facebook.com/selectivetwitter/ Um einen Beitrag auf Facebook zu übertragen, muss nur das Kürzel #fb an die Nachricht angefügt werden]]></description>
			<content:encoded><![CDATA[<p>Um Tweets einfach auf Facebook zu posten, kann folgende Anwendung verwendet werden:</p>
<p><a href="http://apps.facebook.com/selectivetwitter/">http://apps.facebook.com/selectivetwitter/</a></p>
<p>Um einen Beitrag auf Facebook zu übertragen, muss nur das Kürzel #fb an die Nachricht angefügt werden</p>
]]></content:encoded>
			<wfw:commentRss>http://robert.xn--schbel-yxa.net/2011/03/25/twitter-on-facebook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Neues Projekt Zeiterfassung</title>
		<link>http://robert.xn--schbel-yxa.net/2011/01/31/neues-projekt-zeiterfassung/</link>
		<comments>http://robert.xn--schbel-yxa.net/2011/01/31/neues-projekt-zeiterfassung/#comments</comments>
		<pubDate>Mon, 31 Jan 2011 17:42:56 +0000</pubDate>
		<dc:creator>Robert Schöbel</dc:creator>
				<category><![CDATA[usefull stuff]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Codeigniter 2]]></category>
		<category><![CDATA[Doctrine 2]]></category>
		<category><![CDATA[hmvc]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[ORM]]></category>

		<guid isPermaLink="false">http://robert.xn--schbel-yxa.net/?p=521</guid>
		<description><![CDATA[Ein neues Projekt wird realisiert: Zeiterfassung Architektur: Ziel: jQuery als Ajax Framework Codeigniter 2 als (H)MVC Framework Doctrine 2 als ORM Framework coming soon]]></description>
			<content:encoded><![CDATA[<p>Ein neues Projekt wird realisiert: Zeiterfassung</p>
<p>Architektur:</p>
<p><a rel="attachment wp-att-522" href="http://robert.xn--schbel-yxa.net/2011/01/31/neues-projekt-zeiterfassung/architektur/"><img class="alignnone size-medium wp-image-522" title="Architektur" src="http://robert.xn--schbel-yxa.net/wp-content/uploads/2011/01/architektur-300x96.png" alt="Architektur" width="300" height="96" /></a></p>
<p>Ziel:</p>
<p>jQuery als Ajax Framework</p>
<p>Codeigniter 2 als (H)MVC Framework</p>
<p>Doctrine 2 als ORM Framework</p>
<p>coming soon</p>
]]></content:encoded>
			<wfw:commentRss>http://robert.xn--schbel-yxa.net/2011/01/31/neues-projekt-zeiterfassung/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Externe USB Festplatte in Debian anbinden</title>
		<link>http://robert.xn--schbel-yxa.net/2011/01/06/externe-usb-festplatte-in-debian-anbinden/</link>
		<comments>http://robert.xn--schbel-yxa.net/2011/01/06/externe-usb-festplatte-in-debian-anbinden/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 20:41:27 +0000</pubDate>
		<dc:creator>Robert Schöbel</dc:creator>
				<category><![CDATA[usefull stuff]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mount]]></category>

		<guid isPermaLink="false">http://robert.xn--schbel-yxa.net/?p=482</guid>
		<description><![CDATA[Ziel externe USB Festplatte in Debian anbinden und als Sicherung nutzen 1. Ext3 formatieren 2. Festplatte mounten 3. einmal pro Tag Sicherung ziehen Befehle: fdisk -l Festplatten anzeigen Usb ist /dev/sdb und besitzt Einstiegspunkt /dev/sdb1 mkfs.ext3 /dev/sdb1 formatiert das Medium Befehl um Uuid anzuzeigen: blkid sdb1 wird jetzt in die fstab Datei eingetragen nano /etc/fstab [...]]]></description>
			<content:encoded><![CDATA[<p>Ziel externe USB Festplatte in Debian anbinden und als Sicherung nutzen</p>
<p>1. Ext3 formatieren</p>
<p>2. Festplatte mounten</p>
<p>3. einmal pro Tag Sicherung ziehen</p>
<p>Befehle:</p>
<p>fdisk -l</p>
<p>Festplatten anzeigen</p>
<p>Usb ist /dev/sdb</p>
<p>und besitzt Einstiegspunkt /dev/sdb1</p>
<p>mkfs.ext3 /dev/sdb1</p>
<p>formatiert das Medium</p>
<p>Befehl um Uuid anzuzeigen: blkid </p>
<p><a rel="attachment wp-att-487" href="http://robert.xn--schbel-yxa.net/2011/01/06/externe-usb-festplatte-in-debian-anbinden/blkid/"><img class="alignnone size-thumbnail wp-image-487" title="blkid" src="http://robert.xn--schbel-yxa.net/wp-content/uploads/2011/01/blkid-150x150.png" alt="" width="150" height="150" /></a></p>
<p>sdb1 wird jetzt in die fstab Datei eingetragen</p>
<p>nano /etc/fstab</p>
<p>listet die Festplatten</p>
<p><a rel="attachment wp-att-499" href="http://robert.xn--schbel-yxa.net/2011/01/06/externe-usb-festplatte-in-debian-anbinden/fstab-10/"><img class="alignnone size-thumbnail wp-image-499" title="fstab" src="http://robert.xn--schbel-yxa.net/wp-content/uploads/2011/01/fstab9-150x150.png" alt="" width="150" height="150" /></a></p>
<p>Uuid wird benötigt damit die Festplatte immer an die selbe Stelle gemountet wird</p>
<p>Batch Datei zur Datensicherung erzeugen</p>
<p>nano backup.sh</p>
<p>Inhalt:</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#!/bin/bash<br />
mount /mnt/usbsicherung<br />
DATUM=`date +%Y%m%d`<br />
PFAD=/mnt/usbsicherung/sicherung/<br />
DATEI=backup_${DATUM}.tar<br />
FULLSAVE=${PFAD}_${DATEI}<br />
echo  Speichere in  $FULLSAVE<br />
tar -Pcf ${FULLSAVE} /var/<br />
echo Umount<br />
umount /mnt/usbsicherung<br />
echo END</div></div>
<p>Script ausführbar machen</p>
<p>chmod u+x backup.sh</p>
<p>Datei in die Cronjobs eintragen (jede Nacht eine Sicherung)</p>
<p>crontab -e</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">1 2 * * * /home/userfolder/backup.sh</div></div>
<p>(Backup um 2 Uhr und eine Minute)</p>
]]></content:encoded>
			<wfw:commentRss>http://robert.xn--schbel-yxa.net/2011/01/06/externe-usb-festplatte-in-debian-anbinden/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenLdap HowTo</title>
		<link>http://robert.xn--schbel-yxa.net/2010/11/21/openldap-howto/</link>
		<comments>http://robert.xn--schbel-yxa.net/2010/11/21/openldap-howto/#comments</comments>
		<pubDate>Sun, 21 Nov 2010 16:49:26 +0000</pubDate>
		<dc:creator>Robert Schöbel</dc:creator>
				<category><![CDATA[usefull stuff]]></category>
		<category><![CDATA[LDAP]]></category>

		<guid isPermaLink="false">http://robert.xn--schbel-yxa.net/?p=464</guid>
		<description><![CDATA[Ziele: OpenLdap auf Windows nutzen OU, User und Gruppen anlegen mit Benutzeroberfläche Struktur: Vorgehen: OpenLdap downloaden und installieren slapd.conf anpassen LDIF Datei anlegen JXplorer nutzen um LDAP mit GUI zu bearbeiten 1.  OpenLdap für Windows gibt es einen Server auf der Userbooster-Seite Sonst auf OpenLdap Installation erfolgt über GUI Datenbank: Barkley Datenbank Server: sonne 2.  [...]]]></description>
			<content:encoded><![CDATA[<p>Ziele:</p>
<p>OpenLdap auf Windows nutzen</p>
<p>OU, User und Gruppen anlegen mit Benutzeroberfläche</p>
<p>Struktur:</p>
<p><a href="http://robert.xn--schbel-yxa.net/wp-content/uploads/2010/11/ldapstruktur1.png"><img class="alignnone size-thumbnail wp-image-469" title="ldapstruktur" src="http://robert.xn--schbel-yxa.net/wp-content/uploads/2010/11/ldapstruktur1-150x150.png" alt="" width="150" height="150" /></a></p>
<p>Vorgehen:</p>
<ol>
<li>OpenLdap downloaden und installieren</li>
<li>slapd.conf anpassen</li>
<li>LDIF Datei anlegen</li>
<li>JXplorer nutzen um LDAP mit GUI zu bearbeiten</li>
</ol>
<p><strong>1.  OpenLdap</strong></p>
<p>für Windows gibt es einen Server auf der <a href="http://www.userbooster.de/download/openldap-for-windows.aspx" target="_blank">Userbooster</a>-Seite</p>
<p>Sonst auf <a href="http://www.openldap.org/software/download/" target="_blank">OpenLdap</a></p>
<p>Installation erfolgt über GUI</p>
<p>Datenbank: Barkley Datenbank</p>
<p>Server: sonne</p>
<p><strong>2.  slapd.conf anpassen</strong></p>
<p>Verzeichnis: &lt;Laufwerk&gt;/&#8230;/openLDAP/slapd.conf</p>
<p>Einträge anpassen</p>
<pre lang="text">database    bdb
suffix        "dc=domain-name&gt;"
rootdn        "cn=Manager,dc=&lt;domain-name&gt;"
rootpw    secret
directory ./data
</pre>
<p>mein Domain ist nur &#8220;sonne&#8221; (Testumgebung)</p>
<pre lang="text">database    bdb
suffix        "dc=sonne"
rootdn        "cn=Manager,dc=sonne"
rootpw    secret
directory ./data
</pre>
<p>!Bei copy &amp; paste entstehen evtl. Leerzeichen die dann Fehler hervorrufen!</p>
<p><strong>3. LDIF &#8211; Datei erstellen</strong></p>
<p>Ohne eine initiale LDIF Datei (<em><strong>L</strong>DAP <strong>D</strong>ata <strong>I</strong>nterchange <strong>F</strong>ormat)</em> enstanden bei immer Fehler mit dem JXplorer, da die Objekte die in der slapd.conf festgelegt waren, noch nicht existierten.</p>
<p>folgende Fehler im JXplorer deuten daruf hin:</p>
<ul>
<li>unable to list dc=&lt;domain&gt;</li>
<li>Unable to perform Read entry operation.</li>
<li>LDAP: error code 32 &#8211; No Such Object</li>
</ul>
<p>d.h. eine Datei init.ldif erzeugen (die Datei muss nicht im openLDAP Ordner abgelegt werden)<em> </em></p>
<pre lang="text">dn: dc=sonne
objectClass: dcObject
objectClass: organization
dc: sonne
o: Standort

dn: ou=myUsers,dc=sonne
objectClass: organizationalUnit
objectClass: top
ou: myUser

dn: uid=user1,ou=myUsers,dc=sonne
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
objectClass: top
cn: Robert Schoebel
sn: schoebel
uid: user1

dn: cn=Manager,dc=sonne
objectClass: organizationalRole
objectClass: top
cn: Manager

dn: ou=myGroups,dc=sonne
objectClass: organizationalUnit
objectClass: top
ou: myGroups

dn: cn=projectadmin,ou=myGroups,dc=sonne
objectClass: groupOfNames
objectClass: top
cn: projectadmin
member: cn=robert schoebel,ou=myUsers,dc=sonne
</pre>
<p>!Achtung bei Copy und Paste, Leerzeichen erzeugen Fehler beim Import!</p>
<p><strong>4. JXplorer nutzen um LDAP mit GUI zu bearbeiten</strong></p>
<p>dazu <a href="http://jxplorer.org/" target="_blank">JXplorer</a> laden</p>
<p>nach der Installation muss eine Verbindung zum Ldap hergestellt werden</p>
<p>dazu im openLDAP Ordner die <strong>slapd.exe</strong> ausführen</p>
<p>und im JXplorer die Connection wie folgt einstellen:</p>
<p><a href="http://robert.xn--schbel-yxa.net/wp-content/uploads/2010/11/ldap.png"><img class="alignnone size-thumbnail wp-image-465" title="ldap" src="http://robert.xn--schbel-yxa.net/wp-content/uploads/2010/11/ldap-150x150.png" alt="LDAP connection jxplorer" width="150" height="150" /></a></p>
<p>jetzt wird die LDIF-Datei importiert und reconnected und schon steht das LDAP bereit</p>
<p><a href="http://robert.xn--schbel-yxa.net/wp-content/uploads/2010/11/ldapldif.png"><img class="alignnone size-thumbnail wp-image-470" title="ldapldif" src="http://robert.xn--schbel-yxa.net/wp-content/uploads/2010/11/ldapldif-150x124.png" alt="" width="150" height="124" /></a></p>
<p>alle weiteren Änderungen können jetzt mit dem JXplorer erfolgen</p>
]]></content:encoded>
			<wfw:commentRss>http://robert.xn--schbel-yxa.net/2010/11/21/openldap-howto/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

