I'm using the Truevault API and creating a schema for my Vault and eventually the documents that I store in it.
Here is my code:
$trueVault = new TrueVault(array(
"apiKey" => TRUEVAULT_API_KEY,
"accountId" => TRUEVAULT_ACCOUNT_ID
));
$schemas = $trueVault->schemas(TRUEVAULT_VAULT_ID);
$documents = $trueVault->documents(TRUEVAULT_VAULT_ID);
$blobs = $trueVault->blobs(TRUEVAULT_VAULT_ID);
var_dump($trueVault->findAllVaults());
$schemas = $schemas->findAll();
var_dump($schemas);
$schemaId = array_search("Referral Form", $schemas);
var_dump($schemaId);
if (!$schemaId) {
//THIS LINE IS GETTING THE ERROR:
$schema = $schemas->create(array("name" => "Referral Form", "fields" => array(array("name" => "name", "index" => true, "type" => "string"))));
$schemaId = $schema["id"];
echo($schemaId);
}
When I run the code on my server, I get the following error:
Fatal error: Call to a member function create() on array in ...