1. Go to this page and download the library: Download sowork/phalcon-eagerload library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sowork / phalcon-eagerload example snippets
namespace Phalcon\Mvc\Model;
use Sowork\EagerLoad\Traits\EagerLoadingTrait;
/**
* Class User
* @package App\Models
*/
class Book extends Model
{
use EagerLoadingTrait;
public function getSource()
{
return 'users';
}
public function initialize()
{
parent::initialize();
$this->belongsTo( 'id', App\Author::class,'bookId', [
'alias' => 'blogs'
]);
}
}