ZF 2.0 option classes for methods

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ZF 2.0 option classes for methods

icando76185
For easy usage of methods is it possible, to add option classes for methods that accept options as array or Zend_Config?

Code Assist in IDE's would propose the appropriate options including description.

/**
 * @property-read string $host     What host to connect to...
 * @property-read string $username Connect to the database...
 * @property-read string $password Password associated with the...
 * @property-read string $dbname   The name of the database to user
 */
class Zend_Db_Options___Factory extends Zend_Config {
}

$options = new Zend_Db_Options___Factory();
$options->host = '127.0.0.1';
$options->username = 'webuser';
$options->password = 'xxxxxxxx';
$options->dbname = 'test';

$db = Zend_Db::factory('Pdo_Mysql', $options);

For performance reasons, it is easy to convert the above code to native array if needed.

$options = array(
        'host' => '127.0.0.1',
        'username' => 'webuser',
        'password' => 'xxxxxxxx',
        'dbname' => 'test'
);

Michael Rasmussen

PS: I hope you understand my english.

--
GMX DSL: Internet, Telefon und Entertainment für nur 19,99 EUR/mtl.!
http://portal.gmx.net/de/go/dsl02

Reply | Threaded
Open this post in threaded view
|

Re: ZF 2.0 option classes for methods

till
On Mon, Mar 15, 2010 at 4:51 PM,  <[hidden email]> wrote:

> For easy usage of methods is it possible, to add option classes for methods that accept options as array or Zend_Config?
>
> Code Assist in IDE's would propose the appropriate options including description.
>
> /**
>  * @property-read string $host     What host to connect to...
>  * @property-read string $username Connect to the database...
>  * @property-read string $password Password associated with the...
>  * @property-read string $dbname   The name of the database to user
>  */

I think these are used to do cover __get() (and well, __set() with
@property-write).

Till

Reply | Threaded
Open this post in threaded view
|

Re: ZF 2.0 option classes for methods

icando76185
> I think these are used to do cover __get() (and well, __set()
> with @property-write).

@Till

Ups, it should be @property and yes it is to cover __get() and __set().

Michael Rasmussen

--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01