NYCPHP Meetup

NYPHP.org

[nycphp-talk] Database Design Patterns

Jon Baer jonbaer at jonbaer.com
Fri May 11 15:43:18 EDT 2007


Im biased and was talking specifically re: CakePHP AR HBTM  
implementation ...
http://manual.cakephp.org/chapter/models

Your simple join would be as simple as:
class A extends AppModel { $var hasMany = array("B"); }
class B extends AppModel { $var belongsTo = array("A"); }
$a = $this->A->findById($id);
$a['B']['field'];
(provided you have a b_id in table A)

This would be the core idea you would have to wrap a CI library  
around from what I can tell.  But like I said Id too would be  
interested to know if the facility already exists in CI.

- Jon

On May 11, 2007, at 3:11 PM, Joseph Crawford wrote:

> Jon,
>
> I was aware that the CI active record pattern is not the best
> implementation and if we were to go with a true active record i would
> roll my own and integrate it into CI in one way or another.
>
> I am just not sure what the benefits are for this as I read
> documentation i do not see how the joins are done for you as you put
> it.



More information about the talk mailing list