Sunday
5
October
2008

Migrating your Script using Zend_File_Transfer from 1.6.1 to a newer release

Hy interested ones,

most of you know this already. But it seems that users tend not to read migration notes so I will say it once more here.

When you are using Zend_File_Transfer in conjunction with validations you will have to note that the API has changed.

I added a $breakChainOnFailure parameter which allows to break the validation chain for further validators if a validation error occurs.

To give you an example:

// Example for 1.6.1 or earlier
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('FilesSize', array('1B', '100kB'));
// Same example for 1.6.2 and newer
// Note the added boolean false
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('FilesSize', false, array('1B', '100kB'));

So as conclusio for you:
If you have to migrate old scripts simply add a boolean false after the validator name.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework

Back to top