Skip to content

Commit

Permalink
SQL and PHP cases
Browse files Browse the repository at this point in the history
PHP true,false,null in lowercase
SQL keywords uppercase
  • Loading branch information
Alexandra Nantel committed Aug 25, 2017
1 parent 3047c6f commit 3a6f6d5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
12 changes: 6 additions & 6 deletions extension.driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ public function install(){
try{
Symphony::Database()->query("
CREATE TABLE IF NOT EXISTS `tbl_fields_selectbox_link` (
`id` int(11) unsigned NOT NULL auto_increment,
`field_id` int(11) unsigned NOT NULL,
`allow_multiple_selection` enum('yes','no') NOT NULL default 'no',
`hide_when_prepopulated` enum('yes','no') NOT NULL default 'no',
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`field_id` INT(11) UNSIGNED NOT NULL,
`allow_multiple_selection` ENUM('yes','no') NOT NULL default 'no',
`hide_when_prepopulated` ENUM('yes','no') NOT NULL default 'no',
`related_field_id` VARCHAR(255) NOT NULL,
`limit` int(4) unsigned NOT NULL default '20',
`limit` INT(4) UNSIGNED NOT NULL default '20',
PRIMARY KEY (`id`),
KEY `field_id` (`field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Expand Down Expand Up @@ -90,7 +90,7 @@ public function update($previousVersion = false){

if(version_compare($previousVersion, '1.19', '<')){
try{
Symphony::Database()->query("ALTER TABLE `tbl_fields_selectbox_link` ADD COLUMN `show_association` enum('yes','no') NOT NULL default 'yes'");
Symphony::Database()->query("ALTER TABLE `tbl_fields_selectbox_link` ADD COLUMN `show_association` ENUM('yes','no') NOT NULL default 'yes'");
}
catch(Exception $e){
// Discard
Expand Down
32 changes: 16 additions & 16 deletions fields/field.selectbox_link.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ public function fetchSuggestionTypes()
public function createTable(){
return Symphony::Database()->query(
"CREATE TABLE IF NOT EXISTS `tbl_entries_data_" . $this->get('id') . "` (
`id` int(11) unsigned NOT NULL auto_increment,
`entry_id` int(11) unsigned NOT NULL,
`relation_id` int(11) unsigned DEFAULT NULL,
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`entry_id` INT(11) UNSIGNED NOT NULL,
`relation_id` INT(11) UNSIGNED DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `entry_id` (`entry_id`),
KEY `relation_id` (`relation_id`)
Expand All @@ -91,7 +91,7 @@ public function set($field, $value){
$this->_settings[$field] = $value;
}

public function findOptions(array $existing_selection=NULL,$entry_id=NULL){
public function findOptions(array $existing_selection = null, $entry_id = null){
$values = array();
$limit = $this->get('limit');

Expand All @@ -116,7 +116,7 @@ public function findOptions(array $existing_selection=NULL,$entry_id=NULL){
);

EntryManager::setFetchSorting($section->getSortingField(), $section->getSortingOrder());
$entries = EntryManager::fetch(NULL, $section->get('id'), $limit, 0, null, null, false, false);
$entries = EntryManager::fetch(null, $section->get('id'), $limit, 0, null, null, false, false);

$results = array();
foreach($entries as $entry) {
Expand Down Expand Up @@ -157,7 +157,7 @@ public function getToggleStates(){
return $output;
}

public function toggleFieldData(array $data, $newState, $entry_id=null){
public function toggleFieldData(array $data, $newState, $entry_id = null){
$data['relation_id'] = $newState;
return $data;
}
Expand All @@ -182,7 +182,7 @@ public function fetchAssociatedEntryIDs($value){
));
}

public function fetchAssociatedEntrySearchValue($data, $field_id=NULL, $parent_entry_id=NULL){
public function fetchAssociatedEntrySearchValue($data, $field_id = null, $parent_entry_id = null){
// We dont care about $data, but instead $parent_entry_id
if(!is_null($parent_entry_id)) return $parent_entry_id;

Expand Down Expand Up @@ -442,7 +442,7 @@ public function displaySettingsPanel(XMLElement &$wrapper, $errors = null){
$wrapper->appendChild($label);

// Options
$div = new XMLElement('div', NULL, array('class' => 'two columns'));
$div = new XMLElement('div', null, array('class' => 'two columns'));
$wrapper->appendChild($div);

// Allow selection of multiple items
Expand Down Expand Up @@ -477,7 +477,7 @@ public function displaySettingsPanel(XMLElement &$wrapper, $errors = null){
}

public function checkPostFieldData($data, &$message, $entry_id = null){
$message = NULL;
$message = null;

if (is_array($data)) {
$data = isset($data['relation_id'])
Expand Down Expand Up @@ -524,7 +524,7 @@ public function commit(){

SectionManager::removeSectionAssociation($id);
foreach($this->get('related_field_id') as $field_id){
SectionManager::createSectionAssociation(NULL, $id, $field_id, $this->get('show_association') == 'yes' ? true : false);
SectionManager::createSectionAssociation(null, $id, $field_id, $this->get('show_association') == 'yes' ? true : false);
}

return true;
Expand All @@ -537,7 +537,7 @@ public function commit(){
public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null) {
$entry_ids = array();
$options = array(
array(NULL, false, NULL)
array(null, false, null)
);

if(!is_null($data['relation_id'])){
Expand Down Expand Up @@ -578,7 +578,7 @@ public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWit
if($this->get('required') != 'yes') $label->appendChild(new XMLElement('i', __('Optional')));
$label->appendChild(
Widget::Select($fieldname, $options, ($this->get('allow_multiple_selection') == 'yes' ? array(
'multiple' => 'multiple') : NULL
'multiple' => 'multiple') : null
))
);

Expand All @@ -588,7 +588,7 @@ public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWit
else $wrapper->appendChild($label);
}

public function processRawFieldData($data, &$status, &$message=null, $simulate=false, $entry_id=null) {
public function processRawFieldData($data, &$status, &$message = null, $simulate = false, $entry_id = null) {
$status = self::__OK__;
$result = array();

Expand Down Expand Up @@ -636,7 +636,7 @@ public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = fa
$wrapper->appendChild($list);
}

public function getParameterPoolValue(array $data, $entry_id=NULL){
public function getParameterPoolValue(array $data, $entry_id = null){
return $this->prepareExportValue($data, ExportableField::LIST_OF + ExportableField::ENTRY, $entry_id);
}

Expand Down Expand Up @@ -850,7 +850,7 @@ public function fetchFilterableOperators()
);
}

public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation=false){
public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = false){
$field_id = $this->get('id');

if(preg_match('/^sql:\s*/', $data[0], $matches)) {
Expand Down Expand Up @@ -962,7 +962,7 @@ private function getRelatedFieldsId() {
return explode(',', $related_field_id);
}

public function buildSortingSQL(&$joins, &$where, &$sort, $order='ASC'){
public function buildSortingSQL(&$joins, &$where, &$sort, $order = 'ASC'){
if(in_array(strtolower($order), array('random', 'rand'))) {
$sort = 'ORDER BY RAND()';
}
Expand Down

0 comments on commit 3a6f6d5

Please sign in to comment.