示例#1
0
文件: Users.php 项目: torchline/frest
 public function setup()
 {
     $this->setTableSettings(array(Settings::table('user', array(Settings::field('id', 'ID', Variable::INT), Settings::field('rank', 'RankID', Variable::INT), Settings::field('token', 'AccessToken', Variable::STRING), Settings::field('name', 'Name', Variable::STRING), Settings::field('modified', 'DateModified', Variable::STRING)))));
     $this->modifyReadSettings(array(Settings::readResource('rank', 'Ranks', 'id', NULL, TRUE), Settings::readField('modified', Filter::SQL_DATE_TO_TIMESTAMP), Settings::readResources('inbox', 'Messages', array('fields' => 'id,text,sender(id,name,rank(name))', 'receiver' => $this->injectValue('id'))), Settings::readResources('outbox', 'Messages', array('fields' => 'id,text,receiver(id,name)', 'sender' => $this->injectValue('id')))));
     $this->setCreateSettings(array(Settings::create('rank', FALSE), Settings::create('token', FALSE), Settings::create('name')));
     $this->setUpdateSettings(array(Settings::update('rank'), Settings::update('token'), Settings::update('name')));
     $this->setOrderSettings(array(Settings::order('id'), Settings::order('rank'), Settings::order('name'), Settings::order('modified')));
 }
示例#2
0
 public function setup()
 {
     $this->setDefaultLimit(10);
     $this->setMaxLimit(200);
     $this->setTableSettings(array(Settings::table('city', array(Settings::field('id', 'ID', Variable::INT), Settings::field('name', 'Name', Variable::STRING), Settings::field('country', 'CountryCode', Variable::STRING), Settings::field('district', 'District', Variable::STRING), Settings::field('population', 'Population', Variable::INT)))));
     $this->setReadSettings(array(Settings::readField('id'), Settings::readField('name'), Settings::readResource('country', 'Countries', 'code'), Settings::readField('district'), Settings::readField('population')));
     $this->setCreateSettings(array(Settings::create('name'), Settings::create('country')));
     $this->setUpdateSettings(array(Settings::update('name'), Settings::update('country'), Settings::update('district'), Settings::update('population')));
     $this->setOrderSettings(array(Settings::order('id'), Settings::order('name'), Settings::order('country'), Settings::order('district'), Settings::order('population')));
     $this->setConditionSettings(array(Settings::condition('id'), Settings::condition('name'), Settings::condition('country'), Settings::condition('district'), Settings::condition('population')));
 }
示例#3
0
 public function setup()
 {
     $this->setTableSettings(array(Settings::table('message', array(Settings::field('id', 'ID', Variable::INT), Settings::field('sender', 'SenderUserID', Variable::INT), Settings::field('receiver', 'ReceiverUserID', Variable::INT), Settings::field('text', 'Text', Variable::STRING), Settings::field('created', 'DateCreated', Variable::STRING)))));
     $this->setReadSettings(array(Settings::readField('id'), Settings::readResource('sender', 'Users', 'id'), Settings::readResource('receiver', 'Users', 'id'), Settings::readField('text'), Settings::readField('created', Filter::SQL_DATE_TO_TIMESTAMP)));
     $this->setCreateSettings(array(Settings::create('sender'), Settings::create('receiver'), Settings::create('text')));
 }