Question

I´m actually on a project and working with lithium framework for PHP. I´m using multiple databases (MongoDB and MySQL) and on the MySQL database I have lots of many to many relations between my tables. I´ve been reading about lithium relationships between models and i found the "belongs to" relation. Is it possible to use this belongs to relation twice? if it is, can somebody explain me how?

Thanks in advance!

Was it helpful?

Solution

<?php

class Posts extends \lithium\data\Model {

    public $belongsTo = ["Categories", "Users"];

    // -- or --

    public $belongsTo = ["Categories", "Author" => ["class" => "Users"]];
}

?>

Hope that helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top