AshishJoshi-asj / zfdatagrid

Automatically exported from code.google.com/p/zfdatagrid
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Forms inheritance #190

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Bvb_Grid_Form now inherits from Zend_Form directly. There is no (native)
multiple inheritance in PHP.

Problem:

If we have custom Zend_Form descendant class (My_Form_From_Zend_Form),
Bvb_Grid_Form will not inherit from it.

Solution 1:
Making custom form inherit from Bvb_Grid_Form.

This is a good solution if we're not using forms for other purposes.

Or, considering Bvb_Grid_Form is currently just adding to the Zend_Form,
not changing its behavior, derive custom class from Bvb_Grid_Form and hope
Bvb_Grid_Form will not change some basic behavior in the future?

Solution 2:
Duplicate all the code in two classes (My_From_FROM_Bvb_Grid_Form and
My_Form_From_Zend_Form).

Solution 3:
Set the form class name to the the grid, like $_rowClass and $_rowsetClass
in Zend_Db_Table.

Do you think there is a simple solution to this problem? 

What is your opinion about this?
Maybe not for 0.6 release, but to think about in 0.7?

Original issue reported on code.google.com by vlatko.b...@gmail.com on 26 Feb 2010 at 10:28

GoogleCodeExporter commented 9 years ago
Hi,

Please check if this s okay for you.

When instantiating the Bvb_Grid_Form it now receives two optional params

$formClass and $formOptions

Allowing this setting your own form class.

$form = new Bvb_Grid_Form('My_Form_That_Extends_Zend_Form',array());

The $formOptions will be passed to the constructor of $formClass.

Revision 700

Best Regards,
Bento Vilas Boas

Original comment by pao.fre...@gmail.com on 27 Feb 2010 at 3:53

GoogleCodeExporter commented 9 years ago
Hi, 

this is great. Much flexibility is gained with this.

Original comment by vlatko.b...@gmail.com on 28 Feb 2010 at 9:00

GoogleCodeExporter commented 9 years ago

Original comment by pao.fre...@gmail.com on 28 Feb 2010 at 2:59

GoogleCodeExporter commented 9 years ago

Original comment by bento.vi...@gmail.com on 3 Mar 2010 at 4:56