<?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>FlashApe &#187; php</title>
	<atom:link href="http://www.visible-form.com/blog/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.visible-form.com/blog</link>
	<description>Rich Rodecker's blog on flash, flex, actionscript, javascript, and php, with a dash of randomness</description>
	<lastBuildDate>Fri, 24 Jun 2011 23:43:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Sending an ArrayCollection &#8211; Flex to amfphp</title>
		<link>http://www.visible-form.com/blog/sending-an-arraycollection-flex-to-amfphp/</link>
		<comments>http://www.visible-form.com/blog/sending-an-arraycollection-flex-to-amfphp/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 14:00:24 +0000</pubDate>
		<dc:creator>rich</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.visible-form.com/blog/?p=437</guid>
		<description><![CDATA[Here are my tweaks to amfphp for sending an ArrayCollection from Flex to amfphp. May not be the cleanest or most proper but it works. From what I understand, there is an ArrayCollection class included in Zend_AMF, but I haven't looked into that. I've been sending ArrayCollections from php to Flex for a while, it's]]></description>
			<content:encoded><![CDATA[<p>Here are my tweaks to amfphp for sending an ArrayCollection from Flex to amfphp.  May not be the cleanest or most proper but it works.  From what I understand, there is an ArrayCollection class included in Zend_AMF, but I haven't looked into that.</p>
<p>I've been sending ArrayCollections from php to Flex for a while, it's pretty simple and info for doing that can be found at Wade Arnold's blog <a href="http://wadearnold.com/blog/flash/amfphp/amfphp-arraycollection" title="AMFPHP ArrayCollection">here</a>.   The issue going the other direction is that Flex only sends the AC's underlying source array when serializing it for amf.  So when amfphp unpacks the data, you're dealing with a normal array.</p>
<p>Obviously, the first thing you'll need is your ArrayCollection class to use (I use the version that extends ArrayObject at the link above), and make sure it is in your include path.</p>
<p>The first tweak to amfphp is to the method <code>AMFBaseDeserializer->mapClass()</code>.  In that method, right after the checks looking for CommandMessage and RemotingMessage types, I added a similar check for ArrayCollection:</p>
<div class="igBar"><span id="lphp-5"><a href="#" onclick="javascript:showPlainTxt('php-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-5">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$typeIdentifier</span> == <span style="color:#FF0000;">"flex.messaging.io.ArrayCollection"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">new</span> ArrayCollection<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Next change is to the <code>AMFDeserializer->readAmf3Object()</code> method.  Near the middle of the method, around line 570, there is a check for ArrayCollection, and if found it will call the readAmf3Data() method.  I changed it to pass in a value of "true" to the method, you'll see why in a sec:</p>
<div class="igBar"><span id="lphp-6"><a href="#" onclick="javascript:showPlainTxt('php-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-6">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$classDefinition</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'externalizable'</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$type</span> == <span style="color:#FF0000;">'flex.messaging.io.ArrayCollection'</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$obj</span> = <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readAmf3Data</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000000; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Now just two small tweaks to the <code>readAmf3Data()</code> method.  I changed the method signature to add an $isArrayCollection parameter, which just gets forwarded on when calling readAmf3Array.  Here's the whole method:</p>
<div class="igBar"><span id="lphp-7"><a href="#" onclick="javascript:showPlainTxt('php-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-7">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> readAmf3Data<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$isArrayCollection</span> = <span style="color:#000000; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$type</span> = <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readByte</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">switch</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$type</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">case</span> 0x00 : <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">null</span>; <span style="color:#FF9933; font-style:italic;">//undefined</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">case</span> 0x01 : <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">null</span>; <span style="color:#FF9933; font-style:italic;">//null</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">case</span> 0x02 : <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">false</span>; <span style="color:#FF9933; font-style:italic;">//boolean false</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">case</span> 0x03 : <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">true</span>;&nbsp; <span style="color:#FF9933; font-style:italic;">//boolean true</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">case</span> 0x04 : <span style="color:#616100;">return</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readAmf3Int</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">case</span> 0x05 : <span style="color:#616100;">return</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readDouble</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">case</span> 0x06 : <span style="color:#616100;">return</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readAmf3String</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">case</span> 0x07 : <span style="color:#616100;">return</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readAmf3XmlString</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">case</span> 0x08 : <span style="color:#616100;">return</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readAmf3Date</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">case</span> 0x09 : <span style="color:#616100;">return</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readAmf3Array</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$isArrayCollection</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">case</span> 0x0A : <span style="color:#616100;">return</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readAmf3Object</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">case</span> 0x0B : <span style="color:#616100;">return</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readAmf3XmlString</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">case</span> 0x0C : <span style="color:#616100;">return</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readAmf3ByteArray</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">default</span>: <a href="http://www.php.net/trigger_error"><span style="color:#000066;">trigger_error</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"undefined Amf3 type encountered: "</span> . <span style="color:#0000FF;">$type</span>, <span style="color:#000000; font-weight:bold;">E_USER_ERROR</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Now just another two small tweaks to the readAmf3Array method.  As with the readAmf3Data() method, we add the $isArrayCollection parameter.  Within the body of the method, I just check if that param is true when creating the $hashtable variable, and if it is, use an ArrayCollection instead of a regular array:</p>
<div class="igBar"><span id="lphp-8"><a href="#" onclick="javascript:showPlainTxt('php-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-8">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> readAmf3Array<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$isArrayCollection</span> = <span style="color:#000000; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$handle</span> = <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readAmf3Int</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$inline</span> = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$handle</span> &amp; <span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>&nbsp; != <span style="color:#CC66CC;color:#800000;">0</span> <span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#0000FF;">$handle</span> = <span style="color:#0000FF;">$handle</span>&gt;&gt; <span style="color:#CC66CC;color:#800000;">1</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$inline</span> <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$hashtable</span> = <span style="color:#0000FF;">$isArrayCollection</span> ? <span style="color:#000000; font-weight:bold;">new</span> ArrayCollection<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> : <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">storedObjects</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = &amp; <span style="color:#0000FF;">$hashtable</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$key</span> = <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readAmf3String</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">while</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$key</span> != <span style="color:#FF0000;">""</span> <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$value</span> = <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readAmf3Data</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$hashtable</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$key</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0000FF;">$value</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$key</span> = <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readAmf3String</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">for</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$i</span> = <span style="color:#CC66CC;color:#800000;">0</span>; <span style="color:#0000FF;">$i</span> &lt;<span style="color:#0000FF;">$handle</span>; <span style="color:#0000FF;">$i</span>++<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//Grab the type for each element.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$value</span> = <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readAmf3Data</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$hashtable</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$i</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#0000FF;">$value</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$hashtable</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">storedObjects</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF;">$handle</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>That's it.  Now I can send the an AC to the server, serialize it, unserialize it and send it back to Flex with no issues.  The one thing that may an issue is if one of the items within an AC is also another AC...haven't checked out if that works yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visible-form.com/blog/sending-an-arraycollection-flex-to-amfphp/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Frameworks 2.0</title>
		<link>http://www.visible-form.com/blog/frameworks-2-0/</link>
		<comments>http://www.visible-form.com/blog/frameworks-2-0/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 08:19:03 +0000</pubDate>
		<dc:creator>rich</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.visible-form.com/blog/?p=434</guid>
		<description><![CDATA[Subititled: "The Rise of 'Burger King' frameworks....'have it your way'". I am loving the new trend I'm seeing in a lot of the frameworks (both client- and server-side) I've been checking out lately. What I'm seeing is a move away from the monolithic, "do it my way or suffer trying to work around it" approach,]]></description>
			<content:encoded><![CDATA[<p>Subititled: "The Rise of 'Burger King' frameworks....'have it your way'".</p>
<p>I am loving the new trend I'm seeing in a lot of the frameworks (both client- and server-side) I've been checking out lately.  What I'm seeing is a move away from the monolithic, "do it my way or suffer trying to work around it" approach, towards more architectures that provide a more generalized, "less is more" approach, even to the point that some of the functionality and/or features of the "do-it-all" frameworks are being broken out into smaller, specialized bits that allow the developer to pick and choose between whichever approach best suits their style.</p>
<p>To me, the main benefit of the new trend is readily apparent:  just as different individuals would write the same story different ways, the same goes for writing code.  For one framework to dictate too much influence over too many aspects of an application, or even worse to make it difficult to extend or adapt to suit your needs, provides too much lock-in and and can hinder more than it's trying to help.</p>
<p>On the flash/flex side, frameworks like <a href="http://www.robotlegs.org/">RobotLegs</a> , <a href="http://opensource.adobe.com/wiki/display/cairngorm/Cairngorm">Cairngorm 3</a>, <a href="http://www.gaiaflashframework.com/">Gaia</a>, and even libraries like <a href="http://casalib.org/">CasaLib</a> provide example of this (ok, Gaia probably goes a little further as far as initial structure, but once you start developing it stays out of your way).  On the backend, for php you have things such as <a href="http://konstrukt.dk/">Konstrukt</a>, a "URI-to-controller-mapping" (i.e., REST) framework which handles "routing based on logic rather than rules", and the <a href="http://www.outlet-orm.org/site/">Outlet</a> and <a href="http://phpdatamapper.com/">phpDataMapper</a> ORM frameworks.</p>
<p>One thing about the above mentioned frameworks is that most, if not all, can be used <em>in conjunction with each other</em> (<a href="http://jessewarden.com/2009/10/how-to-use-robotlegs-on-top-of-gaia-part-1-of-3-quickstart.html">like so</a>).   If you don't like the way one part does it's job, you can more than likey swap out that part with a similar one without affecting the other parts of an application, provided you we good with encapsulation and keeping things pretty cleanly separated. This is not an insignificant side effect of the "less-is-more" approach, it's the central theme.  It's having it your way.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visible-form.com/blog/frameworks-2-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Propel DATETIME errors</title>
		<link>http://www.visible-form.com/blog/propel-datetime-errors/</link>
		<comments>http://www.visible-form.com/blog/propel-datetime-errors/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 19:26:28 +0000</pubDate>
		<dc:creator>rich</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.visible-form.com/blog/?p=350</guid>
		<description><![CDATA[If you use the PHP ORM framework Propel, you may have hit the error "DateTime::__construct(): Failed to parse time string (CURRENT_TIMESTAMP)" when generating your php classes if a column in your table schema uses DATETIME. Im previous version it seemed like the generator would ignore the error and continue to generate the rest of the]]></description>
			<content:encoded><![CDATA[<p>If you use the PHP ORM framework Propel, you may have hit the error "DateTime::__construct(): Failed to parse time string (CURRENT_TIMESTAMP)" when generating your php classes if a column in your table schema uses DATETIME.  Im previous version it seemed like the generator would ignore the error and continue to generate the rest of the classes, but I recently updated my installation and now it breaks it.</p>
<p>I did some searching at first and saw someone saying that it was because the date.timezone setting for php was not set.  So I added <code>date.timezone=UTC</code> to php.ini, and changed the PHP_COMMAND in the phing script to include the ini file, since running php from the command line does not automatically include it:<br />
<code>PHP_COMMAND="/Applications/MAMP/bin/php5/bin/php -c /Applications/MAMP/conf/php5/php.ini"</code></p>
<p>None of that worked, however, and after digging around a bit more I found there is a new undocumented attribute you can use in your schema.xml file called defaultExpr, which will insert the result of the expression directly into the database.  So I just set <code>defaultExpr="now()"</code> and everything was good to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visible-form.com/blog/propel-datetime-errors/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nice Yum Repository</title>
		<link>http://www.visible-form.com/blog/nice-yum-repository/</link>
		<comments>http://www.visible-form.com/blog/nice-yum-repository/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 06:02:08 +0000</pubDate>
		<dc:creator>rich</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.visible-form.com/blog/?p=327</guid>
		<description><![CDATA[I'd love to hear if anyone has some other recommendations, but if you're using RHEL/CentOS and you want to upgrade your php/mysql installation using Yum, you should check out the utterramblings yum repository. It has the latest versions of php, mysql, and a few others. I upgraded today and it was instant and painless (a]]></description>
			<content:encoded><![CDATA[<p>I'd love to hear if anyone has some other recommendations, but if you're using RHEL/CentOS and you want to upgrade your php/mysql installation using Yum, you should check out the <a href="http://www.jasonlitka.com/yum-repository/">utterramblings yum repository</a>.  It has the latest versions of php, mysql, and a few others.  I upgraded today and it was instant and painless (a rarity).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visible-form.com/blog/nice-yum-repository/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cool MySQL increment/decrement value tip</title>
		<link>http://www.visible-form.com/blog/cool-mysql-incrementdecrement-value-tip/</link>
		<comments>http://www.visible-form.com/blog/cool-mysql-incrementdecrement-value-tip/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 03:34:52 +0000</pubDate>
		<dc:creator>rich</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.visible-form.com/blog/?p=309</guid>
		<description><![CDATA[I needed to adjust a value in a column in a database table by 1, for all rows. I found out you can do it easily by doing this: PLAIN TEXT PHP: $sql = "UPDATE images SET displayIndex=displayIndex +1 WHERE gallery_id=1"; Turning that into a function we can specify if we want to increment or]]></description>
			<content:encoded><![CDATA[<p>I needed to adjust a value in a column in a database table by 1, for all rows.  I found out you can do it easily by doing this:</p>
<div class="igBar"><span id="lphp-11"><a href="#" onclick="javascript:showPlainTxt('php-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-11">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"UPDATE images SET displayIndex=displayIndex +1 WHERE gallery_id=1"</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Turning that into a function we can specify if we want to increment or decrement the value pretty easily.  You can also provide a starting point for the adjustment (so if you delete the item with displayIndex=15, you only want to decrement the displayIndexes greater than 15 by 1)  and specify a different value for the WHERE clause:</p>
<div class="igBar"><span id="lphp-12"><a href="#" onclick="javascript:showPlainTxt('php-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-12">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">public <span style="color:#000000; font-weight:bold;">function</span> updateDisplayIndexes<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$galleryID</span>, <span style="color:#0000FF;">$startIndex</span>, <span style="color:#0000FF;">$add</span> = <span style="color:#000000; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$operator</span> = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$add</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <span style="color:#FF0000;">'+'</span> : <span style="color:#FF0000;">'-'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$sql</span> = <span style="color:#FF0000;">"UPDATE images SET displayIndex=displayIndex"</span>.<span style="color:#0000FF;">$operator</span>.<span style="color:#FF0000;">"1 WHERE gallery_id=$galleryID AND displayIndex&gt; $startIndex"</span>;&nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$result</span> = <a href="http://www.php.net/mysql_query"><span style="color:#000066;">mysql_query</span></a> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$sql</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>There's a lot more you can do with it but it's been a pretty good starting point.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visible-form.com/blog/cool-mysql-incrementdecrement-value-tip/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flex + AMFPHP:  Mapping Value Objects</title>
		<link>http://www.visible-form.com/blog/flex-amfphp-mapping-value-objects/</link>
		<comments>http://www.visible-form.com/blog/flex-amfphp-mapping-value-objects/#comments</comments>
		<pubDate>Sun, 03 Aug 2008 01:09:19 +0000</pubDate>
		<dc:creator>rich</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.visible-form.com/blog/?p=296</guid>
		<description><![CDATA[Update: Added code samples to end of post. One of the issues I see a lot of with people using AMFPHP is how to properly map VO classes between Flex and php. It used to stress me out too, until I realized how easy it really is. First thing: Don't worry about the package paths]]></description>
			<content:encoded><![CDATA[<p><em><strong>Update:</strong> Added code samples to end of post.</em></p>
<p>One of the issues I see a lot of with people using AMFPHP is how to properly map VO classes between Flex and php.  It used to stress me out too, until I realized how easy it really is.</p>
<p>First thing:  Don't worry about the package paths in the RemoteClass metadata tag and $_explicitType variables in your php classes.  You don't need them.</p>
<p>Second thing:  Just use the name of the class you are mapping in for the values RemoteClass("alias="") and $_explicitType="".  For example, if you wanted to map a value object named 'Book' between flex and php, just use:</p>
<div class="igBar"><span id="lactionscript-21"><a href="#" onclick="javascript:showPlainTxt('actionscript-21'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-21">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>RemoteClass<span style="color: #66cc66;">&#40;</span>alias=<span style="color: #ff0000;">"Book"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
and </p>
<div class="igBar"><span id="lphp-22"><a href="#" onclick="javascript:showPlainTxt('php-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-22">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$_explicitType</span>=<span style="color:#FF0000;">"Book"</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Like i already mentioned, you don't need the package names.  The reasons behind this are:</p>
<ul>
<li>When sending from php to Flex, Flex will match the <code>$_explicitType</code> variable to the Remote class alias.  It's just an id to match...it doesn't even have to be the class name...it can be jibberrish, as long as both strings match. (This won't work the other way though...see next item)</li>
<li>When sending from Flex to php, AMFPHP will try to load the class with the name specified by the RemoteObject alias value.  It simply looks in a specified directory to try and load the class...if it can't find it it's parsed as an array.</li>
</ul>
<p>So, how does AMFPHP know where to look for the vo classes?  Easy...you tell it exactly which directory to look in by setting the $voPath variable in globals.php.  I usually do something along the lines of :</p>
<div class="igBar"><span id="lphp-23"><a href="#" onclick="javascript:showPlainTxt('php-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-23">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$voPath</span> = <span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">"DOCUMENT_ROOT"</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#FF0000;">"/path/to/vo/directory"</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Here's a more flushed out code sample:</p>
<div class="igBar"><span id="lactionscript-24"><a href="#" onclick="javascript:showPlainTxt('actionscript-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-24">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package com.<span style="color: #006600;">website</span>.<span style="color: #006600;">vos</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>RemoteClass<span style="color: #66cc66;">&#40;</span>alias=<span style="color: #ff0000;">"Book"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Book</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> title:<span style="color: #0066CC;">String</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> author:<span style="color: #0066CC;">String</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Book<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lphp-25"><a href="#" onclick="javascript:showPlainTxt('php-25'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-25">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> Book <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$_explicitType</span>=<span style="color:#FF0000;">"Book"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$title</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$author</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Say for example the Book.php class file is sitting on the server at webroot/php/classes/vos/Book.php.  In order to tell AMFPHP where to look for the Book.php file, you open up globals.php in your AMFPHP installation, and set the $voPath variable to point to the 'vos' folder:</p>
<div class="igBar"><span id="lphp-26"><a href="#" onclick="javascript:showPlainTxt('php-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-26">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$voPath</span> = <span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">"DOCUMENT_ROOT"</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#FF0000;">"/php/classes/vos"</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
Now when you send a Book object from Flex to php, AMFPHP will look in the $voPath (which we just set to the 'vos' folder) for the Book.php file.  </p>
<p>Note that the $voPath variable is the <em>starting point</em> of where AMFPHP will start to look.  If you specify a full package path for the RemoteClass alias, such as:</p>
<div class="igBar"><span id="lactionscript-27"><a href="#" onclick="javascript:showPlainTxt('actionscript-27'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-27">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#91;</span>RemoteClass<span style="color: #66cc66;">&#40;</span>alias=<span style="color: #ff0000;">"com.website.vos.Book"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>then all the dots in the string are converted to slashes, and the full path is used.  To continue with the example above, we have already set $voPath to point to the 'vos' folder, and the RemoteClass alias has been set to "com.website.vos.Book".  AMFPHP converts the alias to "com/website/vos/Book" and will attempt to locate the file $voPath/com/website/vos/Book.php.  In addition, if you're mapping this object from php back top Flex, remember the $_explicitType variable still must match the string for the RemoteClass alias, so you'd need to set that to:</p>
<div class="igBar"><span id="lphp-28"><a href="#" onclick="javascript:showPlainTxt('php-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-28">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$_explicitType</span>=<span style="color:#FF0000;">"com.website.vos.Book"</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.visible-form.com/blog/flex-amfphp-mapping-value-objects/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Sending Negative Integers through AMFPHP</title>
		<link>http://www.visible-form.com/blog/sending-negative-integers-through-amfphp/</link>
		<comments>http://www.visible-form.com/blog/sending-negative-integers-through-amfphp/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 20:55:23 +0000</pubDate>
		<dc:creator>rich</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.visible-form.com/blog/?p=272</guid>
		<description><![CDATA[There is a weird bug in AMFPHP regarding sending negative integers. If you try and send a number such as -87, it shows up as 4294967209 in php. I did some digging and found on the amfphp forums that it has to do with amfphp's readAmf3Int() method in AMFDeserialzer.php. Here is the updated function that]]></description>
			<content:encoded><![CDATA[<p>There is a weird bug in AMFPHP regarding sending negative integers.  If you try and send a number such as -87, it shows up as 4294967209 in php.  I did some digging and <a href="http://sourceforge.net/forum/message.php?msg_id=4440685">found on the amfphp forums</a> that it has to do with amfphp's readAmf3Int() method in AMFDeserialzer.php.  Here is the updated function that was posted on the forum:</p>
<div class="igBar"><span id="lphp-30"><a href="#" onclick="javascript:showPlainTxt('php-30'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-30">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> readAmf3Int<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$res</span> = <span style="color:#CC66CC;color:#800000;">0</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$int</span> = <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readByte</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$int</span> &lt;<span style="color:#CC66CC;color:#800000;">128</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$int</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#616100;">else</span> <span style="color:#006600; font-weight:bold;">&#123;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$int</span> = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$int</span> &amp; 0x7f<span style="color:#006600; font-weight:bold;">&#41;</span> &lt;&lt;<span style="color:#CC66CC;color:#800000;">7</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$tmp</span> = <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readByte</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$tmp</span> &lt;<span style="color:#CC66CC;color:#800000;">128</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$int</span> |= <span style="color:#0000FF;">$tmp</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$int</span> = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$int</span> | <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$tmp</span> &amp; 0x7f<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> &lt;&lt;<span style="color:#CC66CC;color:#800000;">7</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$tmp</span> = <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readByte</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$tmp</span> &lt;<span style="color:#CC66CC;color:#800000;">128</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$int</span> |= <span style="color:#0000FF;">$tmp</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$int</span> = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$int</span> | <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$tmp</span> &amp; 0x7f<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> &lt;&lt;<span style="color:#CC66CC;color:#800000;">8</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$tmp</span> = <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">readByte</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$int</span> |= <span style="color:#0000FF;">$tmp</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$mask</span> = <span style="color:#CC66CC;color:#800000;">1</span>&lt;&lt;<span style="color:#CC66CC;color:#800000;">28</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$res</span> = -<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$int</span> &amp; <span style="color:#0000FF;">$mask</span><span style="color:#006600; font-weight:bold;">&#41;</span> | <span style="color:#0000FF;">$int</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$res</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.visible-form.com/blog/sending-negative-integers-through-amfphp/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>AMFEXT doesn&#8217;t handle incoming arraycollections</title>
		<link>http://www.visible-form.com/blog/amfext-doesnt-handle-incoming-arraycollections/</link>
		<comments>http://www.visible-form.com/blog/amfext-doesnt-handle-incoming-arraycollections/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 20:15:57 +0000</pubDate>
		<dc:creator>rich</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.visible-form.com/blog/amfext-doesnt-handle-incoming-arraycollections/</guid>
		<description><![CDATA[Ran into an issue today with AMFPHP trying to send an ArrayCollection...it kept choking when trying to decode the collection. I knew this was already possible, but forgot I had installed the php extension AMFEXT, which handles the encoding/decoding for amfphp when it is installed. Turns out that it doesn't like incoming arraycollections. Disabling the]]></description>
			<content:encoded><![CDATA[<p>Ran into an issue today with AMFPHP trying to send an ArrayCollection...it kept choking when trying to decode the collection.  I knew this was already possible, but forgot I had installed the php extension <a href="http://www.teslacore.it/wiki/index.php?title=AMFEXT">AMFEXT</a>, which handles the encoding/decoding for amfphp when it is installed.  Turns out that it doesn't like incoming arraycollections.  Disabling the extension fixed my problem, but I would sure like find a way to get them working together.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visible-form.com/blog/amfext-doesnt-handle-incoming-arraycollections/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IMagick &#8211; ImageMagick extension for PHP</title>
		<link>http://www.visible-form.com/blog/imagick-imagemagick-extension-for-php/</link>
		<comments>http://www.visible-form.com/blog/imagick-imagemagick-extension-for-php/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 17:30:50 +0000</pubDate>
		<dc:creator>rich</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.visible-form.com/blog/imagick-imagemagick-extension-for-php/</guid>
		<description><![CDATA[If you're spending a decent amount of time manipulating images in php using GD or command-line ImageMagick, you should check out the Imagick php extension. Imagick provides an object-oriented interface to the ImageMagick API. As far as I can tell, this extension was left for dead a while ago but revitalized over the last year]]></description>
			<content:encoded><![CDATA[<p>If you're spending a decent amount of time manipulating images in php using GD or command-line ImageMagick, you should check out the <a href="http://us3.php.net/imagick" title="Imagick php ImageMagick extension">Imagick php extension</a>.  Imagick provides an object-oriented interface to the ImageMagick API. </p>
<p>As far as I can tell, this extension was left for dead a while ago but revitalized over the last year or so and is now rockin pretty hard.  The developer is pretty responsive on the <a href="http://www.imagemagick.org/discourse-server/viewforum.php?f=18&#038;sid=fa2f1394f6509c7d2d31c06f23e54a25">Imagick board at the ImageMagick forums</a> as well, and he's got lots of nice code tidbits on <a href="http://valokuva.org/" title="Lead Imagick developer Mikko Koppanen's blog">his own blog</a>.</p>
<p>There is also the <a href="http://www.bitweaver.org/doc/magickwand/index.html" title="MagickWand for PHP ImageMagick extension">MagickWand For PHP</a> extension,  but I found the syntax pretty odd to deal with, it probably relates more to the way GD works than the OO style of Imagick.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visible-form.com/blog/imagick-imagemagick-extension-for-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Client.Error.DeliveryInDoubt</title>
		<link>http://www.visible-form.com/blog/clienterrordeliveryindoubt/</link>
		<comments>http://www.visible-form.com/blog/clienterrordeliveryindoubt/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 22:36:12 +0000</pubDate>
		<dc:creator>rich</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.visible-form.com/blog/clienterrordeliveryindoubt/</guid>
		<description><![CDATA[Finally getting back into using Flex again, and was trying out the Remote Object tutorial here. Everything went fine for the Hello World tutorial, but I kept getting 'Client.Error.DeliveryInDoubt' messages from the PersonService. I read a couple of places that there had been issues with charset handling in amfphp, so spent a bunch of time]]></description>
			<content:encoded><![CDATA[<p>Finally getting back into  using Flex again, and was trying out the Remote Object tutorial <a href="http://www.sephiroth.it/tutorials/flashPHP/flex_remoteobject/" title="Remote Object amfphp">here</a>. Everything went fine for the Hello World tutorial, but I kept getting 'Client.Error.DeliveryInDoubt' messages from the PersonService.  I read a couple of places that there had been issues with charset handling in amfphp, so spent a bunch of time with that, but still no luck.  Then I remembered that I created the php file for HelloWorld in TextMate, and create the 2 php files for the PersonService in Flex Builder.  Sure enough, after recreating the php files in TextMate everything worked.  I'm not sure if it was an encoding issue, since it seems like both TextMate and FlexBuilder default to utf-8.  I did notice that in FB, the preference for 'New Text File Line Delimiter' (under General/Workspace) was set to default, so I changed it to Unix to line up with TextMate.</p>
<p>Then I went out and installed <a href="http://www.eclipse.org/pdt/" title="PDT PHP Eclipse plugin">PDT</a> to set up a PHP perspective within FB.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visible-form.com/blog/clienterrordeliveryindoubt/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
