Prev | Current Page 578 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

db.Manager class. You need to provide two of these: one for the
Chapter class and one for the Author class. Again, because of the reverse data queries, these two classes
should look very similar. Here is the AuthorManager class:
class AuthorManager extends neko.db.Manager < Author >
{
public static var cmgr : ChapterManager;
public function new()
{
super(Author);
ChapterManager.amgr = this;
}
function make( a : Author ) : Void
{
a.chapters = cmgr.getAuthorChapters( a.int_id );
}
public function getChapterAuthors( c : Int ) : List < Author >
{
return objects( ???select distinct u.* from Lookup l inner join
Author u on l.int_author = u.int_id where l.int_chapter = ???
+ c, true );
}
}
And the ChapterManager class:
class ChapterManager extends neko.db.Manager < Chapter >
{
public static var amgr : AuthorManager;
public function new()
{
super(Chapter);
AuthorManager.cmgr = this;
}
function make( c : Chapter ) : Void
{
c.authors = amgr.getChapterAuthors( c.int_id );
}
public function getAuthorChapters( a : Int ) : List < Chapter >
{
return objects( ???select distinct c.


Pages:
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590