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'))); }
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'))); }
public function setup() { $this->setDefaultLimit(10); $this->setMaxLimit(200); $this->setTableSettings(array(Settings::table('country', array(Settings::field('code', 'Code', Variable::STRING), Settings::field('name', 'Name', Variable::STRING), Settings::field('continent', 'Continent', Variable::STRING), Settings::field('region', 'Region', Variable::STRING), Settings::field('surfaceArea', 'SurfaceArea', Variable::FLOAT), Settings::field('independence', 'IndepYear', Variable::INT), Settings::field('population', 'Population', Variable::INT), Settings::field('lifeExpectancy', 'LifeExpectancy', Variable::FLOAT), Settings::field('gnp', 'GNP', Variable::FLOAT), Settings::field('gnpOld', 'GNPOld', Variable::FLOAT), Settings::field('localName', 'LocalName', Variable::STRING), Settings::field('govForm', 'GovernmentForm', Variable::STRING), Settings::field('headOfState', 'HeadOfState', Variable::STRING), Settings::field('capital', 'Capital', Variable::INT), Settings::field('code2', 'Code2', Variable::STRING))))); $this->setReadSettings(array(Settings::readField('code'), Settings::readField('name'), Settings::readField('continent'), Settings::readField('region', NULL, FALSE), Settings::readField('surfaceArea', NULL, FALSE), Settings::readField('independence', NULL, FALSE), Settings::readField('population', NULL, FALSE), Settings::readField('lifeExpectancy', NULL, FALSE), Settings::readField('gnp', NULL, FALSE), Settings::readField('gnpOld', NULL, FALSE), Settings::readField('localName', NULL, FALSE), Settings::readField('govForm', NULL, FALSE), Settings::readField('headOfState', NULL, FALSE), Settings::readField('capital', NULL, FALSE), Settings::readField('code2', NULL, FALSE), Settings::readResources('langs', 'Languages', array('country' => $this->injectValue('code'))), Settings::readResources('mainLangs', 'Languages', array('country' => $this->injectValue('code'), 'percent' => 'gt(10)')))); $this->setCreateSettings(array(Settings::create('code'), Settings::create('name'), Settings::create('continent'), Settings::create('region'), Settings::create('surfaceArea'), Settings::create('independence'), Settings::create('population'), Settings::create('lifeExpectancy'), Settings::create('gnp'), Settings::create('gnpOld'), Settings::create('localName'), Settings::create('govForm'), Settings::create('headOfState'), Settings::create('capital'), Settings::create('code2'))); $this->setUpdateSettings(array(Settings::update('code'), Settings::update('name'), Settings::update('continent'), Settings::update('region'), Settings::update('surfaceArea'), Settings::update('independence'), Settings::update('population'), Settings::update('lifeExpectancy'), Settings::update('gnp'), Settings::update('gnpOld'), Settings::update('localName'), Settings::update('govForm'), Settings::update('headOfState'), Settings::update('capital'), Settings::update('code2'))); $this->setOrderSettings(array(Settings::order('code'), Settings::order('name'), Settings::order('continent'), Settings::order('region'), Settings::order('surfaceArea'), Settings::order('independence'), Settings::order('population'), Settings::order('lifeExpectancy'), Settings::order('gnp'), Settings::order('gnpOld'), Settings::order('localName'), Settings::order('govForm'), Settings::order('headOfState'), Settings::order('capital'), Settings::order('code2'))); $this->setConditionSettings(array(Settings::condition('code'), Settings::condition('name'), Settings::condition('continent'), Settings::condition('region'), Settings::condition('surfaceArea'), Settings::condition('independence'), Settings::condition('population'), Settings::condition('lifeExpectancy'), Settings::condition('gnp'), Settings::condition('gnpOld'), Settings::condition('localName'), Settings::condition('govForm'), Settings::condition('headOfState'), Settings::condition('capital'), Settings::condition('code2'))); }
public function setup() { $this->setDefaultLimit(10); $this->setMaxLimit(200); $this->setTableSettings(array(Settings::table('countrylanguage', array(Settings::field('country', 'CountryCode', Variable::STRING), Settings::field('name', 'Language', Variable::STRING), Settings::field('official', 'IsOfficial', Variable::BOOL), Settings::field('percent', 'Percentage', Variable::FLOAT))))); $this->setReadSettings(array(Settings::readField('name'), Settings::readField('official'), Settings::readField('percent'))); $this->setCreateSettings(array(Settings::create('country'), Settings::create('name'), Settings::create('official', FALSE), Settings::create('percent', FALSE))); $this->setUpdateSettings(array(Settings::update('name'), Settings::update('official'), Settings::update('percent'))); $this->setOrderSettings(array(Settings::order('country'), Settings::order('name'), Settings::order('official'), Settings::order('percent'))); $this->setConditionSettings(array(Settings::condition('country'), Settings::condition('name'), Settings::condition('official'), Settings::condition('percent'))); }
/** * @param string $alias * @param mixed $setting * @return Field|NULL * @throws Exception */ public static function fromJSONAliasSetting($alias, $setting) { $fieldSetting = NULL; if (!isset($setting['resources'])) { // not many-to-one $field = isset($setting['field']) ? $setting['field'] : $alias; $type = isset($setting['type']) ? Type\Variable::typeFromString($setting['type']) : Type\Variable::STRING; if (!isset($type)) { throw new Exception(Exception::Config, "Type '{$setting['type']}' is invalid for alias '{$alias}'"); } $fieldSetting = Settings::field($alias, $field, $type); } return $fieldSetting; }
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'))); }
public function setup() { $this->setTableSettings(array(Settings::table('rank', array(Settings::field('id', 'ID', Variable::INT), Settings::field('name', 'Name', Variable::STRING), Settings::field('ordinal', 'Ordinal', Variable::INT))))); }