hello. i have two tables:
invoices:
invoicesEvents:
also set relations:
// models/invoices.php
public function initialize()
{
// Определяет n-1 отношения
$this->belongsTo("userId", "users", "id");
// Определяет 1-n отношения
$this->hasMany("id", "invoicesEvents", "invoiceId");
}
and
// models/invoicesEvents.php
public function initialize()
{
$this->setSource('invoicesEvents');
// Определяет n-1 отношения
$this->belongsTo("invoiceId", "invoices", "id");
}
the following code
// controllers/ReportsController.php
$exportInvoices = invoices::find(array (
"offerDate BETWEEN '{$cleanedPostData['startDate']}' AND '{$cleanedPostData['endDate']}'",
'order' => 'offerDate ASC',
));
$exportInvoicesEvents = $exportInvoices->getInvoicesEvents(['order' => 'id ASC']); //<----- ERROR LINE
var_dump($exportInvoicesEvents->toarray());
, which would seem to work, an error:
Fatal error: Call to undefined method Phalcon\Mvc\Model\Resultset\Simple::getInvoicesEvents() in ___\app\controllers\ReportsController.php on line 325
Fatal error: Cannot use the memory manager when the request is shutting down in Unknown on line 0
different tried - does not want to run fetch. tell me, what are the options?