Yii pagination samples ?


First off thanks for continuing to produce high quality frameworks. I know from my experience with prado this will also be a powerful tool for any web developer. A couple of quick questions -

  1. Can some CPagination samples be added to the definitive guide (pardon me if I missed it) ?

  2. How would prados' sqlmap operations translate to this framework ? Would it simply be something like





Or would another method be better ?

  1. Are active record relations still dependent on established database relations (ie does the table need to be defined with the foreign keys) ?

Thanks again


Welcome aboard and thank you for making the first post.

1). If you try the "crud" command with yiic, you will find that the generated code already uses CPagination.  Please follow the description in "Creating First Application" in the Guide to see how to use yiic crud command.

2). Yii comes with DAO and Active Record as Prado does. Both are completely rewritten and made cleaner and more efficient. SQLMap is not in Yii due to the fact that it is overly complicated. In fact, we are thinking about a way to unify Active Record and SQLMap, which may be realized in v1.1 release. The code snippet you gave is about using DAO, which is available in both Yii and PRADO.

3). As a matter of fact, AR does not really require relationship definition in DBMS except for MANY_MANY relationship. Currently, AR needs DBMS relationship mainly for sanity checking purpose, i.e., if you do not declare relation in AR class correctly, it will tell you where the error is.


Thanks, the code that was generated from the example application answered a lot of my questions - although there seemed to have been an issue about the login page not being found (http://localhost/testdrive/index.php?r=user/login) - But I was able to work through by commenting access control out in the controller …


Could you elaborate the issue about the login page? How to reproduce the issue?

I think I see the problem, The UserController generated by the web application shell gets replaced when you generate the CRUD for the "user" table because it also generates a UserController … (It does warn you first before overwriting it.)