Aerospike\LDT\LDT::__construct PHP Method

__construct() protected method

Constructor for the abstract \Aerospike\LDT class. Inherited by LDT types.
See also: errorno()
See also: error()
protected __construct ( Aerospike $client, array $key, string $bin, integer $type )
$client Aerospike
$key array initialized with Aerospike::initKey()
$bin string name
$type integer of the LDT
    protected function __construct(Aerospike $client, array $key, $bin, $type)
    {
        $this->key = $key;
        $this->bin = $bin;
        $this->type = $type;
        $this->module = $this->getModuleName();
        $this->client = $client;
        if (!$client->isConnected()) {
            if ($client->errorno() !== Aerospike::OK) {
                $this->errorno = $client->errorno();
                $this->error = $client->error();
            } else {
                $this->errorno = Aerospike::ERR_CLUSTER;
                $this->error = "Aerospike object could not successfully connect to the cluster";
            }
        } else {
            $this->errorno = Aerospike::OK;
            $this->error = '';
        }
    }

Usage Example

Example #1
0
 /**
  * Constructor for the \Aerospike\LDT\LList class.
  *
  * @param Aerospike $db
  * @param array $key initialized with Aerospike::initKey()
  * @param string $bin name
  * @see LDT::__construct()
  */
 public function __construct(Aerospike $db, array $key, $bin)
 {
     parent::__construct($db, $key, $bin, LDT::LLIST);
 }