protected function configure(string $collection, string $primaryKey = 'id', string $relationship = '')
    {
        if ($relationship) {
            $reference = get_parent_class($this);
            $call = 'construct';
            if (method_exists($reference, $call)) {
                $reference::$call();
            }
        }

        if ($this->collection) {
            $this->parents[$relationship] = clone $this;
            $this->add($relationship)->integer()->collection($collection)->update(false);
            if (!$relationship) {
                throw new SimplesRunTimeError("When extending one model you need give a name to relationship");
            }
        }
        $this->collection = $collection;
        $this->primaryKey = $primaryKey;

        $this->add($this->hashKey)->hashKey();
        foreach ([$this->destroyKeys, $this->createKeys, $this->updateKeys] as $keys) {
            foreach ($keys as $key => $name) {
                $this->add($name)->type($this->getTimestampType($key))->recover(false);
            }
        }
        $this->add($primaryKey)->primaryKey();

        return $this;
    }
protected function configure(string $collection, string $primaryKey = 'id', string $relationship = '')
    {
        if ($relationship) {
            $reference = get_parent_class($this);
            $call = 'construct';
            if (method_exists($reference, $call)) {
                $reference::$call();
            }
        }

        if ($this->collection) {
            $this->parents[$relationship] = clone $this;
            $this->add($relationship)->integer()->collection($collection)->update(false);
            if (!$relationship) {
                throw new SimplesRunTimeError("When extending one model you need give a name to relationship");
            }
        }
        $this->collection = $collection;
        $this->primaryKey = $primaryKey;

        $this->add($this->hashKey)->hashKey();
        foreach ([$this->destroyKeys, $this->createKeys, $this->updateKeys] as $keys) {
            foreach ($keys as $key => $name) {
                $this->add($name)->type($this->getTimestampType($key))->recover(false);
            }
        }
        $this->add($primaryKey)->primaryKey();

        return $this;
    }
protected function configure ( string $ collection , string $ primaryKey = 'id' , string $ relationship = '' ) { if ( $ relationship ) { $ reference = get_parent_class ( $ this ) ; $ call = 'construct' ; if ( method_exists ( $ reference , $ call ) ) { $ reference :: $ call ( ) ; } } if ( $ this -> collection ) { $ this -> parents [ $ relationship ] = clone $ this ; $ this -> add ( $ relationship ) -> integer ( ) -> collection ( $ collection ) -> update ( false ) ; if ( ! $ relationship ) { throw new SimplesRunTimeError ( "When extending one model you need give a name to relationship" ) ; } } $ this -> collection = $ collection ; $ this -> primaryKey = $ primaryKey ; $ this -> add ( $ this -> hashKey ) -> hashKey ( ) ; foreach ( [ $ this -> destroyKeys , $ this -> createKeys , $ this -> updateKeys ] as $ keys ) { foreach ( $ keys as $ key => $ name ) { $ this -> add ( $ name ) -> type ( $ this -> getTimestampType ( $ key ) ) -> recover ( false ) ; } } $ this -> add ( $ primaryKey ) -> primaryKey ( ) ; return $ this ; }
Configure the instance with reference properties
@param string $collection
@param string $primaryKey ('id')
@param string $relationship ('')
@return $this
@throws SimplesRunTimeError
Configure the instance with reference properties