SitePoint Sponsor

User Tag List

Page 3 of 3 FirstFirst 123
Results 51 to 52 of 52
  1. #51
    Spirit Coder allspiritseve's Avatar
    Join Date
    Dec 2002
    Location
    Ann Arbor, MI (USA)
    Posts
    648
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sysk View Post
    Sure. However, the property has to be an array of the same object type.

    <propertyName pivot="pivotTableName" class="objectClassName" />

    By the way, I will update dORM soon. I am currently implementing query refining and prefetching.
    What do you mean "the property has to be an array of the same object type"... arrays don't have object types...

    Maybe an example would explain what I'm going for. Say I have a blog post $post, and comments $comments. I want to map them so you're essentially doing this:

    PHP Code:
    foreach ($comments as $comment){
       
    $post->addComment ($comment);

    How would that be done with dORM?

  2. #52
    SitePoint Enthusiast
    Join Date
    Dec 2007
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    class Post {
     public 
    $comments = array();
     public function 
    addComment($comment) {
      
    $this->comments[] = $comment;
     }
    }
    class 
    Comment {
     public 
    $text;
    }

    $comment = new Comment();
    $comment->text "Test";

    $post->addComment($comment); 
    This is what I meant by "array of the same object type". An array which all values are of the same object type.


Tags for this Thread

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
  •