Results 1 to 3 of 3

Thread: About OOP

  1. #1
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default About OOP

    I have been experimenting with Object Oriented PHP and have a couple questions.

    1) How do I make objects persist? With variables, you can use SESSION, but what about objects? I found this:

    $client_object = &$_SESSION['client_object'];
    $client_object = new Client( $client_id );

    http://blas.phemo.us/articles/2008/0...istence-in-php

    but haven't tried it out yet. Going to now.

    2) Can you describe an object oriented database and how it is different from a relational one? I've read the wikipedia entry on OO database, but it still left me with some questions.

    and somewhat related: Anyone have any experience with Amazon Simple DB?

    Thanks in advance.

    J
    Last edited by JasonDFR; 01-28-2009 at 07:14 AM.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    1) How do I make objects persist? With variables, you can use SESSION, but what about objects? I found this:
    That's exactly the same as saying $_SESSION['client_object'] = new Client($client_id);. I think it should work, since all PHP objects can be serialised.
    2) Can you describe an object oriented database and how it is different from a relational one? I've read the wikipedia entry on OO database, but it still left me with some questions.
    Well, the main difference is that it represents records as objects rather than rows Native object databases aren't very commonly used, although ORMs are quite popular.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    Thanks for the reply Twey.

    What do you think the best way to handle a "User" class would be? Rebuild the class from a db every page load or try to figure out some way to keep it in server memory? I have been reading about this and there seems to be a big debate on a lot of blogs and forums.

    What is an ORM? (Object Relational ...?)

    Thanks !

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •