diff --git a/src/commands/GetInfoCommand.php b/src/commands/GetInfoCommand.php index ee81921..50da3c5 100644 --- a/src/commands/GetInfoCommand.php +++ b/src/commands/GetInfoCommand.php @@ -10,10 +10,15 @@ namespace hiapi\commands; +use hiqdev\DataMapper\Query\Specification; +use hiapi\validators\RefValidator; + abstract class GetInfoCommand extends EntityCommand { public $id; + public $with; + public function getId() { return $this->id; @@ -24,6 +29,17 @@ public function rules() return [ ['id', 'integer', 'min' => 1], ['id', 'required'], + + ['with', 'each', 'rule' => [RefValidator::class]], ]; } + + public function getSpecification(): Specification + { + $spec = new Specification(); + $spec->where = ['id' => $this->getId()]; + $spec->with = $this->with; + + return $spec; + } }