Thanks in advance for help and direction. I am finally making the switch from linear programming to OOP. I am working on my first class ever and I could use a little direction. My first class is a gallery with the following properties
class Gallery
{
//Gallery Name
public $galleryID;
public $galleryName;
//Client Name
public $clientName;
//Gallery Options
public $bg_color;
public $albumAgreement;
public $maxChanges;
public $sharing_on;
//Revisions
public $revisions;
}
My out put thus looks like:
Gallery Object
(
[galleryID] =>
[galleryName] =>
[clientName] =>
[bg_color] =>
[albumAgreement] =>
[maxChanges] =>
[sharing_on] =>
[revisions] =>
)
My next step is I would like to make ‘revisions’ an object as well so that my output would look like
Gallery Object
(
[galleryID] =>
[galleryName] =>
[clientName] =>
[bg_color] =>
[albumAgreement] =>
[maxChanges] =>
[sharing_on] =>
[revisions] => Revisions Object (
[revisionID] =>
[revisionName] =>
)
)
What direction do I go for something like this and what might the class look like?
Thanks
The good thing is PHP is dynamically typed, so your code remains pretty much the same. When you initialize
revisions, just initialize it to be an instance ofRevisionsobject, like thisAs for what the class should look like, based on your var_dump, something like this:
Since what
revisionsdoes is not entirely clear from your question, you might want to make aRevisionobject instead ofRevisions(not the plural), and then have$gallery->revisionsbe an array ofRevision.