public function testToArrayIncludeForeignObjects()
 {
     BookstoreDataPopulator::populate();
     BookPeer::clearInstancePool();
     AuthorPeer::clearInstancePool();
     PublisherPeer::clearInstancePool();
     $c = new Criteria();
     $c->add(BookPeer::TITLE, 'Don Juan');
     $books = BookPeer::doSelectJoinAuthor($c);
     $book = $books[0];
     $arr1 = $book->toArray(BasePeer::TYPE_PHPNAME, null, true);
     $expectedKeys = array('Id', 'Title', 'ISBN', 'Price', 'PublisherId', 'AuthorId', 'Author');
     $this->assertEquals($expectedKeys, array_keys($arr1), 'toArray() can return sub arrays for hydrated related objects');
     $this->assertEquals('George', $arr1['Author']['FirstName'], 'toArray() can return sub arrays for hydrated related objects');
     $c = new Criteria();
     $c->add(BookPeer::TITLE, 'Don Juan');
     $books = BookPeer::doSelectJoinAll($c);
     $book = $books[0];
     $arr2 = $book->toArray(BasePeer::TYPE_PHPNAME, null, true);
     $expectedKeys = array('Id', 'Title', 'ISBN', 'Price', 'PublisherId', 'AuthorId', 'Publisher', 'Author');
     $this->assertEquals($expectedKeys, array_keys($arr2), 'toArray() can return sub arrays for hydrated related objects');
 }