Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dharmastyle committed Dec 4, 2012
1 parent 66ba6bb commit dd1ad7d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
41 changes: 22 additions & 19 deletions AtkSilexConnector.php
Expand Up @@ -2,23 +2,25 @@

namespace Basilico\Atk;

require __FILE__.'/../../web/backoffice/atk.inc';

/**
*
* AtkSilexConnector
*
* @author Dharma <dharma@basili.co>
*/
class AtkSilexConnector
{
/**
*
* Last used node
*/
private $lastNode = null;

/**
*
* Load atk-framework libraries
*/
public function __construct() {

$config_atkroot = realpath(dirname(__FILE__).'/../../../../../web/backoffice').'/';
$GLOBALS['config_atkroot'] = $config_atkroot;
require_once $config_atkroot . "atk.inc";
}

/**
Expand All @@ -39,16 +41,25 @@ public function fetchOne($node, $options=array()) {
}

/**
* Stable API
* (stable API)
*/
public function getRows($query) {
return $this->getDb()->getrows($query);
}


public function setLastNode($node) {
$this->lastNode = $node;
}


/**
* Proxy methods
*/
public function query($query) {
return $this->getDb()->query($query);
}

public function getDb() {
if ($this->lastNode) {
$db = $this->getNode($this->lastNode)->getDb();
Expand All @@ -58,16 +69,8 @@ public function getDb() {

return $db;
}

/**
* Atk method
*/

public function getNode($node) {
return getNode($node);
}

public function setLastNode($node) {
$this->lastNode = $node;
}

}
}
}
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -5,7 +5,7 @@
"name": "Dharma Ferrari",
"email": "dharma@basili.co",
"homepage": "http://www.basili.co",
"role": "Developer"
"role": "Dev"
}
],
"require": {
Expand Down

0 comments on commit dd1ad7d

Please sign in to comment.