[fw-general] Zend Loader performance

2008-05-11 Thread Łukasz Bandzarewicz

Hi all!

During simple profiling I noticed that Zend_Loader could consume 20-25% of
execution time.
It's quite obvious, because ZF has to load lots of files, but..
have you ever wondering about compile ZF code. Something similar to
phpDoctrine's compile method
(http://www.phpdoctrine.org/documentation/manual/0_11?one-page#improving-performance)?

The compile method makes single file of most used components. Additionally
it could remove comments and white spaces to reduce size of compiled file.
It could reduce slow disk operations (check if file exists, load file, etc.)
and increase performance.

What you think, is this feasible?

-- 
View this message in context: 
http://www.nabble.com/Zend-Loader-performance-tp17170525p17170525.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Form_Element_Select and null values

2008-04-15 Thread Łukasz Bandzarewicz

Hi!

How to handle null values in select elements?

For example I have table:
User {
  region_id: foreign key, can be null
  ..ect
}

I have select with prompt:
select name=region_id
 option value=-1Please select region/option
 option value=1Region1/option
 ..etc
/select

in UsersController::createAction():
$form = new User_Form(); // Zend_Form instance
// handle $_POST data etc.
$data = $form-getValues(true);
// and very ugly:
if ($data['region_id'] == -1) $data['region_id'] = null; // !!

$user = new User(); // this is phpDoctrine record
$user-merge($data);
$user-save();

How to get rid of this redundant code?
Problem is very painful when I have large tables with FK or when I create
records in several places in the code.
-- 
View this message in context: 
http://www.nabble.com/Zend_Form_Element_Select-and-null-values-tp16700805p16700805.html
Sent from the Zend Framework mailing list archive at Nabble.com.