Re: How can I get a list of object vars?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On 8/2/07, js <ebgssth@xxxxxxxxx> wrote:
> you may need to work with the reflective functions for a while to get them
down.
> if  you want to see some usage of them, check out PHPUnit<http://www.phpunit.de/>
.

> Robin Vickery wrote:
> $properties = (array) $myObject;
> no?

no, thats why there are reflective methods.  to expose the private member
variables.

php -a
php > class someObj {
php { private $someVar = null;
php { }
php > $newobj = new someObj();
php > $properties = (array) $newobj;
php > var_dump($properties);
array(1) {
  ["someObjsomeVar"]=>
  NULL
}

-nathan

On 8/2/07, js <ebgssth@xxxxxxxxx> wrote:
>
> Hi list.
>
> I'm trying to write a ORM  in PHP.
> I want the ORM to have metadata mapping, which have a list of  properties
> name
> and the value, without using any external file.
> (I like simple one, not want messy XML)
>
> I'm thinking PHP's reflective functions might help me to do that
> and treid  get_object_vars but it  doesn't  return properties name
> and even value itself when it  haven't been assigned any value.
>
> Is there  any good way to get a list of properties name  and the value?
> Or some good PHP framework's implementation  to study for this?
>
> Thanks in advance.
>
> --
> PHP General Mailing List ( http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux