ArangoDB Model for CakePHP 3.x
- PHP 5.4.16 or greater.
- CakePHP >= 3.0
To use the code just copy the ArangoDB Folder in /src/Model/ folder.
include the models
use App\Model\ArangoDB\Document;
use App\Model\ArangoDB\DocumentModel;
either
$doc= new Document();
$data=array("name"=>"ABC","email"=>"[email protected]");
$doc->setData($data);
$doc->setCollection('users');
$model=new DocumentModel();
$doc=$model->createDoc($doc);
echo $doc->getID();
or
$doc= new Document();
$data=array("name"=>"ABC","email"=>"[email protected]");
$model=new DocumentModel();
//$doc->setData($model->createDoc($data,'users',array("createCollection"-=>true,...)));
$doc->setData($model->createDoc($data,'users'));
echo $doc->getID();
Copy the UserModel.php into the Model Folder and edit the BaseAuthenticate in <app_dir>/vendor/cakephp/cakephp/src/Auth/BaseAuthenticate.php
.......
use App\model\UserModel;
abstract class BaseAuthenticate implements EventListenerInterface
{
..........
protected function _query($username)
{
$config = $this->_config;
$doc=new UserModel();
$query=$doc->findUser($username);
return $query;
}
..........
}