public function addEntitySubject($id, $type = null, $idKey = "id", $typeKey = "type")
    {
        if(!isset($this->_subscription->subject)){
            $this->_subscription->subject = (object) [
                "entities" => [],
                "condition" => (object)["attrs" => []]
            ];
        }

        $entity = (object) [];
        $entity->$idKey = $id;

        if (null != $type) {
            $entity->$typeKey = (string)$type;
        }

        $this->_subscription->subject->entities[] = $entity;
        return $this;
    }
public function addEntitySubject($id, $type = null, $idKey = "id", $typeKey = "type")
    {
        if(!isset($this->_subscription->subject)){
            $this->_subscription->subject = (object) [
                "entities" => [],
                "condition" => (object)["attrs" => []]
            ];
        }

        $entity = (object) [];
        $entity->$idKey = $id;

        if (null != $type) {
            $entity->$typeKey = (string)$type;
        }

        $this->_subscription->subject->entities[] = $entity;
        return $this;
    }
public function addEntitySubject ( $ id , $ type = null , $ idKey = "id" , $ typeKey = "type" ) { if ( ! isset ( $ this -> _subscription -> subject ) ) { $ this -> _subscription -> subject = ( object ) [ "entities" => [ ] , "condition" => ( object ) [ "attrs" => [ ] ] ] ; } $ entity = ( object ) [ ] ; $ entity -> $ idKey = $ id ; if ( null != $ type ) { $ entity -> $ typeKey = ( string ) $ type ; } $ this -> _subscription -> subject -> entities [ ] = $ entity ; return $ this ; }
Add a Entity to subject.entities
@param string $id
@param string $type
@param string $idKey "id"(default) or "idPattern"
@param string $typeKey "type"(default) or "typePattern"
@return \Orion\Context\Subscription
Add a Entity to subject . entities