NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP 5 Objects

Joseph Crawford codebowl at gmail.com
Wed Aug 17 08:53:47 EDT 2005


Guys,

Is there a way to accomplish this?

i am creating a set of objects for storing objects serialized accross pages. 
I have the following


<?php
abstract class Objects {
public function __construct() {

}

abstract function load($class);
abstract function save($class);

}
?>

<?php
class FileObjects extends Objects {

public function __construct() {

}

public function load($class) {

}

public function save($obj) {

}
}
?>

<?php
class FileObjects extends Objects {

public function __construct() {

}

public function load($class) {

}

public function save($obj) {

}
}
?>

The issue i am running into is when i save an object, how do i know what 
type the object is? How do i know it is of type User/Database/FileObject, 
etc... I cannot simply go through a ton of if statements, and i cannot force 
each class to have a __tostring() method.

-- 
Joseph Crawford Jr.
Codebowl Solutions, Inc.
1-802-671-2021
codebowl at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20050817/2fabf0cc/attachment.html>


More information about the talk mailing list