Ich habe drei Modelle mit diesen Beziehungen:
Erlaubnis:
public function initialize()
{
$this->setSchema("ngd_demat");
$this->setSource("p_permission");
$this->belongsTo('idAction', Action::class, 'id', ['alias' => 'Action']);
}
Aktion:
public function initialize()
{
$this->setSchema("ngd_demat");
$this->setSource("p_action");
$this->belongsTo('idResource', Resource::class, 'id', ['alias' => 'Resource']);
$this->hasMany('id', Permission::class, 'idAction', ['alias' => 'Permission']);
}
Ressource:
public function initialize()
{
$this->setSchema("ngd_demat");
$this->setSource("p_resource");
$this->hasMany('id',Action::class,'idResource', ['alias' => 'Action']);
}
Ich möchte die gesamte Ressource libelle :
public static function isAllowed($role){
$resources = [];
$permission = Permission::find('idRole ='.$role.' AND isAllowed = 1');
foreach ($permission->action->resource as $resource){
array_push($resources, $resource->getLibelle());
}
return $resources;
}
Es wird im Apache-Fehlerprotokoll zurückgegeben:
Undefined property: Phalcon\Mvc\Model\Resultset\Simple::$action
Trying to get property 'resource' of non-object
Invalid argument supplied for foreach()
Dies ist das UML-Klassendiagramm:
Ich habe versucht, Alias in Klein- und Großbuchstaben einzufügen, Referenz Modell mit Permission::class oder „Security\Permission“ oder „Permission“. Ich habe den Namensraum „Sicherheit“ in meiner Datei „loader.php“ festgelegt.
Vielen Dank im Voraus.
ORM-Problem – UNDEFINED PROPERTY ⇐ Php
-
- Similar Topics
- Replies
- Views
- Last post
-
-
PHP 7.3 Start -up -Fehler PDO_PGSQL.SO: Undefined Symbol: PDO_Throw_Exception
by Anonymous » » in Php - 0 Replies
- 4 Views
-
Last post by Anonymous
-