Archive

Archive for June, 2009

ZF 1.8.4 breaks addDirectory()

June 27th, 2009

Looks like a bug was introduced in 1.8.4 that breaks class loading from the addDiretory() method. If  you use require_once with setClass or just use the 1.8.3 Zend_Amf_Server class file it will work. Unfortunitly I didn’t write the affected change but hope to have

=== Update July 1st 2009 ===

For some reason in 1.8.4 package there’s an old version of Zend/Loader/PluginLoader.php.

Take the new one here:

http://framework.zend.com/svn/framework/standard/branches/release-1.8/library/Zend/Loader/PluginLoader.php

It should work with it and the Zend Framework team is going to patch the 1.8.4 release on June 2nd to resolve this release issue.

== Update July 7th 2009 ==

http://devzone.zend.com/article/4808-Zend-Framework-1.8.4pl1-Now-Available

This patch-level version corrects a missing patch for Zend_Loader_PluginLoader that provided some critical functionality for Zend_Amf users. If you utilize that component, you are encouraged to upgrade immediately; for all other uses, the release tarball remains the same as the 1.8.4 version, and upgrading is left to your discretion.

Flash Platform, Zend_Amf

Major Zend Amf updates for 1.8.4 release

June 23rd, 2009

Lots of changes made to Zend Amf made there way into Zend Frameworks next mini release for 1.8.4. I thought that I would run through the major changes. Special thanks to Stefan Klug for all of the patches that he produced! Absolutely grateful sir! This is probably the biggest update to the system since the first release. Please make sure that you test 1.8.4 before you push it into your production environment. Why? Well if your like me you probably built a couple work arounds for some of these bugs. Those work arounds may no longer work once the bug is fixed!

Major Changes

ZF-6641 Shared references are duplicated
ZF-6205 Serializer does not support cyclic references
ZF-6393 Wrong Amf0_Amf3 reference counting
ZF-5382 Multiple calls seems to break the deserializer.
ZF-6625 Zend Amf can load any instantiated PHP class. Security

Minor but significant changes

ZF-6975
Adobe Flash Builder 4 wizard now supports data types for introspection.
ZF-6992 Negative integers on 64 bit system is resolved.
ZF-6775 Unable to send Array’s from Blaze DS.

The 1.8.4 release has already been tagged and should come out sometime today 6/23/2009

AMFPHP, Flash Platform, Zend_Amf

ArrayCollection beta update in Zend Amf: thoughts?

June 15th, 2009

I started working on a project this week that extensively uses ArrayCollection’s and I found that ZendAmf could use a couple additions in order to have some utilities for working with ArrayCollections in PHP. The new feature relies heavily on PHP’s SPL and specifically Countable, ArrayAccess, and IteratorAggregate all of which require PHP 5.2.3 or greater.

The following file can be added to your Zend Amf project to play with some of these features. Please let me know if there is anything else that I should add before it is added in the next release. Please post feedback to the blog or directly to the Zend Framework feature request.

Alpha Zend_Amf_Value_Messaging_ArrayCollection

To create an ArrayCollection

$this->_data[] = array('foo' => 'foo1', 'bar' => 'bar1');
$this->_data[] = array('foo' => 'foo2', 'bar' => 'bar2');
$this->_arrayCollection = new Zend_Amf_Value_Messaging_ArrayCollectionTwo($this->_data);

To Create an ArrayCollection from a Zend_Db_Table_row

$table = new Bugs();

$select = $table->select();
$select->where('bug_status = ?', 'NEW');

$rows = $table->fetchAll($select);
$this->_arrayCollection = new Zend_Amf_Value_Messaging_ArrayCollectionTwo($rows);

To alter an element of an ArrayCollection

$this->_arrayCollection = new Zend_Amf_Value_Messaging_ArrayCollection($this->_data);
$total = count($this->_arrayCollection);
echo($total); // outputs 2

To get the size of the array collection


to iterate through the ArrayCollection

$count = 0;
foreach($this->_arrayCollection as $row) {
    $count++;
}
$this->assertEquals(2, $count);

To manipulate an ArrayCollection based on keys.

$this->_arrayCollection = new Zend_Amf_Value_Messaging_ArrayCollection($this->_data);

// See if the offset key exists
$boolean = $this->_arrayCollection->offsetExists(1);

// Alter or add the row at they key offset of 1
$data = array('fooSet' => 'fooSet2', 'barSet' => 'barSet2');
$this->_arrayCollection->offsetSet(1,$data);

// Remove the row at the offset key of 3
$this->_arrayCollection->offsetUnset(3);

// Get the row at the offset 6
$row = $this->_arrayCollection->offsetGet(6);

To change an ArrayCollection to an Array

$standardArray = iterator_to_array($this->_arrayCollection);

To append another row to an ArrayCollection

$this->_arrayCollection->append(array('kung' => 'foo', 'Bruce' => 'Lee'));

– Update –
From a PHP developers perspective this makes little since. I am asking that you comment why you like the new ArrayCollection. I am creating something that can already be done with an array in PHP and then just wrap it into a stub ArrayCollection class. The two things that action script does not do with an array is:

it can not handle sparse array’s. {1=> one, 2=>two, 4=>four} this is a sparse array and Action Script will try and pad the array or just make it an object.

Actionscript can not use strings as the key in the array so it just uses an object. If you want a numerically keyed array of objects they call it an ArrayCollection.

Both of these concepts are handled in PHP as just an Array. So there is no reason that you could not use the Array and then pass the array into a simple ArrayCollection class for it to be parsed back to flex. So when you see the new ArrayCollection class what are the use cases that you feel you would use the class for? Is it just a convenience tool or does it add complexity that does not need to exists?

ActionScript 3, Flash Platform, Zend_Amf

Adobe Flash Builder 4 Beta for PHP developers

June 9th, 2009

I am giving a couple e-seminars about some of the new  features exposed in Flash Builder 4. The examples are all going to be PHP but it the majority of the talk is on tooling. Come check it out and ask questions. It’s still beta so if you want something changed now is the time to ask!

Adobe® Flash Builder 4 Beta (formerly Flex Builder) for PHP developers
Tuesday, June 9, 2009 12:00 PM PT
Thursday, July 16, 2009 11:00 AM PT

Learn about the new improvements with Adobe Flex 4 Beta and how developers working with Flex and PHP are boosting their productivity by combining it use with Zend. This demonstration will show you how you can create a combined project with Flex components and PHP natures and reap the benefit of coding in both languages.

Flash Platform, Zend_Amf