Booking model:
namespace TLH\Models;
class Booking extends \Phalcon\Mvc\Model{
public function initialize(){
$this->setSource('Booking');
//define relations
$this->hasManyToMany(
"Id",
"TLH\Models\BookingCustomer",
"Booking", "Customer",
"TLH\Models\Customer",
"Id"
);
$this->belongsTo("Route","TLH\Models\Route","Id", array("alias" => "RouteInfo"));
}
}
ManyToMany Entity
namespace TLH\Models;
class BookingCustomer extends \Phalcon\Mvc\Model{
public $Booking;
public $Customer;
public $CustomerType;
public function initialize(){
$this->setSource("BookingCustomer");
//define relations column, entity, id
$this->belongsTo("Booking", "TLH\Models\Booking", "Id");
$this->belongsTo("Customer", "TLH\Models\Customer", "Id");
}
}
I am geting this error:
The method "CustomerInfo" doesn't exist on model "TLH\Models\Booking"
//for
$Booking->CustomerInfo("CustomerType=0")
//or
The method "getCustomerInfo" doesn't exist on model "TLH\Models\Booking"
//for
$Booking->getCustomerInfo("CustomerType=0")