[PHP] php5 iterate an object

2006-01-22 Thread Henrik Gemal

I have an object that looks like this:

Test Object
(
[config] = TestConfig Object
(
[file:protected] = test.conf
[kill:protected] = 1
)

[location:private] = test
}


I'm trying to write an PHP5 iterator that can iterate over an object but 
I'm not sure how. The manual for PHP5 iterators seems to only work with 
arrays. How do I iterate over an object and only get the name of the 
attribute (config) and not the entire name (Test::config)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] creating new class from wrapper class (OOP question)

2006-01-18 Thread Henrik Gemal

In a image gallery I have to class'es:

class GPicFilePicture extends GPicFileType
class GPicFileMovie extends GPicFileType

both of them are based on:

abstract class GPicFileType

In my code I need to create a new GPicFilePicture. To avoid duplicated
code I've create a wrapper class:

class GPicFile

that does something like this:

if (fileextension == jpg)
  return new GPicFilePicture();
else
  return new GPicFileMovie();

so my PHP code looks like:
$file = new GPicFile($filename);

getFileDate() is implemented in both GPicFilePicture and GPicFileMovie.

Now I try to do:
$file-getFileDate();

I get an error saying:
Call to undefined method GPicFile::getFileDate()

Where am I going wrong?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php