for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Gewaer\Models;
use Phalcon\Di;
class SystemModules extends AbstractModel
{
/**
*
* @var integer
*/
public $id;
public $name;
public $slug;
* @var string
public $model_name;
public $apps_id;
public $parents_id;
public $menu_order;
public $created_at;
public $updated_at;
public $is_deleted;
* Initialize method for model.
public function initialize()
$this->hasMany(
'id',
'Gewaer\Models\EmailTemplatesVariables',
'system_modules_id',
['alias' => 'templateVariable']
);
'Gewaer\Models\Webhooks',
['alias' => 'webhook']
$this->belongsTo(
'companies_id',
'Gewaer\Models\Companies',
['alias' => 'company']
'apps_id',
'Gewaer\Models\Apps',
['alias' => 'app']
'company_branches_id',
'Gewaer\Models\CompanyBranches',
['alias' => 'companyBranch']
$this->setSource('user_company_apps_activities');
}
* Returns table name mapped in the model.
* @return string
public function getSource(): string
return 'system_modules';
* Get System Module by its model_name
* @param string $model_name
* @return SystemModules
public static function getSystemModuleByModelName(string $model_name):SystemModules
return SystemModules::findFirst([
'conditions' => 'model_name = ?0 and apps_id = ?1',
'bind' => [$model_name, Di::getDefault()->getApp()->getId()]
]);