table() public static method

public static table ( $name )
コード例 #1
0
ファイル: ConfigTest.php プロジェクト: greg0/lazer-database
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->setUpFilesystem();
     $this->object = Config::table('users');
 }
コード例 #2
0
 /**
  * Inserts relation data to config file
  * @param string $from Local table
  * @param string $to Related table
  * @param string $type Relation type
  * @param array $keys Relationed keys
  */
 protected function deleteRelationData($from, $to)
 {
     $config = Config::table($from);
     $content = $config->get();
     unset($content->relations->{$to});
     $config->put($content);
 }
コード例 #3
0
 /**
  * Saving inserted or updated data
  */
 public function save()
 {
     $data = $this->getData();
     if (!$this->currentId) {
         $config = $this->config();
         $config->last_id++;
         $this->set->id = $config->last_id;
         array_push($data, $this->set);
         Helpers\Config::table($this->name)->put($config);
     } else {
         $this->set->id = $this->currentId;
         $data[$this->currentKey] = $this->set;
     }
     Helpers\Data::table($this->name)->put($data);
     //         $this->setFields();
 }
コード例 #4
0
ファイル: Validate.php プロジェクト: greg0/lazer-database
 /**
  * Checking that relation between tables exists
  * @param string $local local table
  * @param string $foreign related table
  * @return bool relation exists
  * @throws LazerException
  */
 public static function relation($local, $foreign)
 {
     $relations = Config::table($local)->relations();
     if (isset($relations->{$foreign})) {
         return TRUE;
     }
     throw new LazerException('Relation "' . $local . '" to "' . $foreign . '" doesn\'t exist');
 }