repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
necrox87/yii2-nudity-detector
NudityDetector.php
NudityDetector.quantifyYCbCr
public function quantifyYCbCr() { // Init some vars $inc = $this->iteratorIncrement; $width = $this->width(); $height = $this->height(); list($Cb1, $Cb2, $Cr1, $Cr2) = $this->boundsCbCr; $white = $this->excludeWhite; $black = $this->excludeBlack; $total = $count = 0; for($x = 0; $x < $width; $x += $inc) for($y = 0; $y < $height; $y += $inc) { list($r, $g, $b) = $this->rgbXY($x, $y); // Exclude white/black colors from calculation, presumably background if((($r > $white) && ($g > $white) && ($b > $white)) || (($r < $black) && ($g < $black) && ($b < $black))) continue; // Converg pixel RGB color to YCbCr, coefficients already divided by 255 $Cb = 128 + (-0.1482 * $r) + (-0.291 * $g) + (0.4392 * $b); $Cr = 128 + (0.4392 * $r) + (-0.3678 * $g) + (-0.0714 * $b); // Increase counter, if necessary if(($Cb >= $Cb1) && ($Cb <= $Cb2) && ($Cr >= $Cr1) && ($Cr <= $Cr2)) $count++; $total++; } return $count / $total; }
php
public function quantifyYCbCr() { // Init some vars $inc = $this->iteratorIncrement; $width = $this->width(); $height = $this->height(); list($Cb1, $Cb2, $Cr1, $Cr2) = $this->boundsCbCr; $white = $this->excludeWhite; $black = $this->excludeBlack; $total = $count = 0; for($x = 0; $x < $width; $x += $inc) for($y = 0; $y < $height; $y += $inc) { list($r, $g, $b) = $this->rgbXY($x, $y); // Exclude white/black colors from calculation, presumably background if((($r > $white) && ($g > $white) && ($b > $white)) || (($r < $black) && ($g < $black) && ($b < $black))) continue; // Converg pixel RGB color to YCbCr, coefficients already divided by 255 $Cb = 128 + (-0.1482 * $r) + (-0.291 * $g) + (0.4392 * $b); $Cr = 128 + (0.4392 * $r) + (-0.3678 * $g) + (-0.0714 * $b); // Increase counter, if necessary if(($Cb >= $Cb1) && ($Cb <= $Cb2) && ($Cr >= $Cr1) && ($Cr <= $Cr2)) $count++; $total++; } return $count / $total; }
[ "public", "function", "quantifyYCbCr", "(", ")", "{", "// Init some vars", "$", "inc", "=", "$", "this", "->", "iteratorIncrement", ";", "$", "width", "=", "$", "this", "->", "width", "(", ")", ";", "$", "height", "=", "$", "this", "->", "height", "(", ")", ";", "list", "(", "$", "Cb1", ",", "$", "Cb2", ",", "$", "Cr1", ",", "$", "Cr2", ")", "=", "$", "this", "->", "boundsCbCr", ";", "$", "white", "=", "$", "this", "->", "excludeWhite", ";", "$", "black", "=", "$", "this", "->", "excludeBlack", ";", "$", "total", "=", "$", "count", "=", "0", ";", "for", "(", "$", "x", "=", "0", ";", "$", "x", "<", "$", "width", ";", "$", "x", "+=", "$", "inc", ")", "for", "(", "$", "y", "=", "0", ";", "$", "y", "<", "$", "height", ";", "$", "y", "+=", "$", "inc", ")", "{", "list", "(", "$", "r", ",", "$", "g", ",", "$", "b", ")", "=", "$", "this", "->", "rgbXY", "(", "$", "x", ",", "$", "y", ")", ";", "// Exclude white/black colors from calculation, presumably background", "if", "(", "(", "(", "$", "r", ">", "$", "white", ")", "&&", "(", "$", "g", ">", "$", "white", ")", "&&", "(", "$", "b", ">", "$", "white", ")", ")", "||", "(", "(", "$", "r", "<", "$", "black", ")", "&&", "(", "$", "g", "<", "$", "black", ")", "&&", "(", "$", "b", "<", "$", "black", ")", ")", ")", "continue", ";", "// Converg pixel RGB color to YCbCr, coefficients already divided by 255", "$", "Cb", "=", "128", "+", "(", "-", "0.1482", "*", "$", "r", ")", "+", "(", "-", "0.291", "*", "$", "g", ")", "+", "(", "0.4392", "*", "$", "b", ")", ";", "$", "Cr", "=", "128", "+", "(", "0.4392", "*", "$", "r", ")", "+", "(", "-", "0.3678", "*", "$", "g", ")", "+", "(", "-", "0.0714", "*", "$", "b", ")", ";", "// Increase counter, if necessary", "if", "(", "(", "$", "Cb", ">=", "$", "Cb1", ")", "&&", "(", "$", "Cb", "<=", "$", "Cb2", ")", "&&", "(", "$", "Cr", ">=", "$", "Cr1", ")", "&&", "(", "$", "Cr", "<=", "$", "Cr2", ")", ")", "$", "count", "++", ";", "$", "total", "++", ";", "}", "return", "$", "count", "/", "$", "total", ";", "}" ]
Quantify flesh color amount using YCbCr color model @return float
[ "Quantify", "flesh", "color", "amount", "using", "YCbCr", "color", "model" ]
train
https://github.com/necrox87/yii2-nudity-detector/blob/59474b1480f5ed53a17f06551318d30c3765d143/NudityDetector.php#L57-L87
necrox87/yii2-nudity-detector
NudityDetector.php
NudityDetector.isPorn
public function isPorn($threshold = FALSE) { return $threshold === FALSE ? $this->quantifyYCbCr() >= $this->threshold : $this->quantifyYCbCr() >= $threshold; }
php
public function isPorn($threshold = FALSE) { return $threshold === FALSE ? $this->quantifyYCbCr() >= $this->threshold : $this->quantifyYCbCr() >= $threshold; }
[ "public", "function", "isPorn", "(", "$", "threshold", "=", "FALSE", ")", "{", "return", "$", "threshold", "===", "FALSE", "?", "$", "this", "->", "quantifyYCbCr", "(", ")", ">=", "$", "this", "->", "threshold", ":", "$", "this", "->", "quantifyYCbCr", "(", ")", ">=", "$", "threshold", ";", "}" ]
Check if image is of pornographic content @param float $threshold
[ "Check", "if", "image", "is", "of", "pornographic", "content" ]
train
https://github.com/necrox87/yii2-nudity-detector/blob/59474b1480f5ed53a17f06551318d30c3765d143/NudityDetector.php#L94-L98
phpmob/changmin
src/PhpMob/CmsBundle/Provider/TranslationLocaleProvider.php
TranslationLocaleProvider.getDefinedLocalesCodes
public function getDefinedLocalesCodes(): array { $locales = $this->localeRepository->findAll(); $locales = array_map( function (LocaleInterface $locale) { return $locale->getCode(); }, $locales ); return array_unique(array_merge([$this->defaultLocaleCode], $locales)); }
php
public function getDefinedLocalesCodes(): array { $locales = $this->localeRepository->findAll(); $locales = array_map( function (LocaleInterface $locale) { return $locale->getCode(); }, $locales ); return array_unique(array_merge([$this->defaultLocaleCode], $locales)); }
[ "public", "function", "getDefinedLocalesCodes", "(", ")", ":", "array", "{", "$", "locales", "=", "$", "this", "->", "localeRepository", "->", "findAll", "(", ")", ";", "$", "locales", "=", "array_map", "(", "function", "(", "LocaleInterface", "$", "locale", ")", "{", "return", "$", "locale", "->", "getCode", "(", ")", ";", "}", ",", "$", "locales", ")", ";", "return", "array_unique", "(", "array_merge", "(", "[", "$", "this", "->", "defaultLocaleCode", "]", ",", "$", "locales", ")", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CmsBundle/Provider/TranslationLocaleProvider.php#L48-L59
nyeholt/silverstripe-external-content
code/model/ExternalContentItem.php
ExternalContentItem.Link
function Link($action = null) { $cur = Controller::curr(); if ($cur instanceof ExternalContentPage_Controller) { return $cur->data()->LinkFor($this, 'view'); } return ExternalContentPage_Controller::URL_STUB . '/view/' . $this->ID; }
php
function Link($action = null) { $cur = Controller::curr(); if ($cur instanceof ExternalContentPage_Controller) { return $cur->data()->LinkFor($this, 'view'); } return ExternalContentPage_Controller::URL_STUB . '/view/' . $this->ID; }
[ "function", "Link", "(", "$", "action", "=", "null", ")", "{", "$", "cur", "=", "Controller", "::", "curr", "(", ")", ";", "if", "(", "$", "cur", "instanceof", "ExternalContentPage_Controller", ")", "{", "return", "$", "cur", "->", "data", "(", ")", "->", "LinkFor", "(", "$", "this", ",", "'view'", ")", ";", "}", "return", "ExternalContentPage_Controller", "::", "URL_STUB", ".", "'/view/'", ".", "$", "this", "->", "ID", ";", "}" ]
Return a URL that simply links back to the externalcontentadmin class' 'view' action @param $action @return String
[ "Return", "a", "URL", "that", "simply", "links", "back", "to", "the", "externalcontentadmin", "class", "view", "action" ]
train
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/code/model/ExternalContentItem.php#L141-L147
nyeholt/silverstripe-external-content
code/model/ExternalContentItem.php
ExternalContentItem.DownloadLink
public function DownloadLink() { // get the base URL, prepend with the external content // controller /download action and add this object's id $cur = Controller::curr(); if ($cur instanceof ExternalContentPage_Controller) { return $cur->data()->LinkFor($this, 'download'); } return ExternalContentPage_Controller::URL_STUB . '/download/' . $this->ID; }
php
public function DownloadLink() { // get the base URL, prepend with the external content // controller /download action and add this object's id $cur = Controller::curr(); if ($cur instanceof ExternalContentPage_Controller) { return $cur->data()->LinkFor($this, 'download'); } return ExternalContentPage_Controller::URL_STUB . '/download/' . $this->ID; }
[ "public", "function", "DownloadLink", "(", ")", "{", "// get the base URL, prepend with the external content", "// controller /download action and add this object's id", "$", "cur", "=", "Controller", "::", "curr", "(", ")", ";", "if", "(", "$", "cur", "instanceof", "ExternalContentPage_Controller", ")", "{", "return", "$", "cur", "->", "data", "(", ")", "->", "LinkFor", "(", "$", "this", ",", "'download'", ")", ";", "}", "return", "ExternalContentPage_Controller", "::", "URL_STUB", ".", "'/download/'", ".", "$", "this", "->", "ID", ";", "}" ]
Where this can be downloaded from @return string
[ "Where", "this", "can", "be", "downloaded", "from" ]
train
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/code/model/ExternalContentItem.php#L169-L177
nyeholt/silverstripe-external-content
code/model/ExternalContentItem.php
ExternalContentItem.stageChildren
public function stageChildren($showAll = false) { if ($this->Title != 'Content Root' && $this->source) { $children = new ArrayList(); $item = new ExternalContentItem($this->source, $this->Title . '1'); $item->Title = $this->Title . '1'; $item->MenuTitle = $item->Title; $children->push($item); return $children; } }
php
public function stageChildren($showAll = false) { if ($this->Title != 'Content Root' && $this->source) { $children = new ArrayList(); $item = new ExternalContentItem($this->source, $this->Title . '1'); $item->Title = $this->Title . '1'; $item->MenuTitle = $item->Title; $children->push($item); return $children; } }
[ "public", "function", "stageChildren", "(", "$", "showAll", "=", "false", ")", "{", "if", "(", "$", "this", "->", "Title", "!=", "'Content Root'", "&&", "$", "this", "->", "source", ")", "{", "$", "children", "=", "new", "ArrayList", "(", ")", ";", "$", "item", "=", "new", "ExternalContentItem", "(", "$", "this", "->", "source", ",", "$", "this", "->", "Title", ".", "'1'", ")", ";", "$", "item", "->", "Title", "=", "$", "this", "->", "Title", ".", "'1'", ";", "$", "item", "->", "MenuTitle", "=", "$", "item", "->", "Title", ";", "$", "children", "->", "push", "(", "$", "item", ")", ";", "return", "$", "children", ";", "}", "}" ]
Overridden to load all children from a remote content source instead of this node directly @param boolean $showAll @return ArrayList
[ "Overridden", "to", "load", "all", "children", "from", "a", "remote", "content", "source", "instead", "of", "this", "node", "directly" ]
train
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/code/model/ExternalContentItem.php#L230-L240
nyeholt/silverstripe-external-content
code/model/ExternalContentItem.php
ExternalContentItem.Children
public function Children() { if (!$this->children) { $this->children = new ArrayList(); $kids = $this->stageChildren(); if ($kids) { foreach ($kids as $child) { if ($child->canView()) { $this->children->push($child); } } } } return $this->children; }
php
public function Children() { if (!$this->children) { $this->children = new ArrayList(); $kids = $this->stageChildren(); if ($kids) { foreach ($kids as $child) { if ($child->canView()) { $this->children->push($child); } } } } return $this->children; }
[ "public", "function", "Children", "(", ")", "{", "if", "(", "!", "$", "this", "->", "children", ")", "{", "$", "this", "->", "children", "=", "new", "ArrayList", "(", ")", ";", "$", "kids", "=", "$", "this", "->", "stageChildren", "(", ")", ";", "if", "(", "$", "kids", ")", "{", "foreach", "(", "$", "kids", "as", "$", "child", ")", "{", "if", "(", "$", "child", "->", "canView", "(", ")", ")", "{", "$", "this", "->", "children", "->", "push", "(", "$", "child", ")", ";", "}", "}", "}", "}", "return", "$", "this", "->", "children", ";", "}" ]
Handle a children call by retrieving from stageChildren
[ "Handle", "a", "children", "call", "by", "retrieving", "from", "stageChildren" ]
train
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/code/model/ExternalContentItem.php#L245-L258
nyeholt/silverstripe-external-content
code/model/ExternalContentItem.php
ExternalContentItem.getCMSFields
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('ParentID'); if (count($this->remoteProperties)) { $mapping = $this->editableFieldMapping(); foreach ($this->remoteProperties as $name => $value) { $field = null; if (isset($mapping[$name])) { $field = $mapping[$name]; if (is_string($field)) { $field = new $field($name, $this->fieldLabel($name), $value); $fields->addFieldToTab('Root.Main', $field); } } else if(!is_object($value) && !is_array($value)){ $value = (string) $value; $field = new ReadonlyField($name, _t('ExternalContentItem.' . $name, $name), $value); $fields->addFieldToTab('Root.Main', $field); } else if(is_object($value) || is_array($value)){ foreach($value as $childName => $childValue) { if(is_object($childValue)) { foreach($childValue as $childChildName => $childChildValue) { $childChildValue = is_object($childChildValue) || is_array($childChildValue) ? json_encode($childChildValue) : (string) $childChildValue; $field = new ReadonlyField("{$childName}{$childChildName}", "{$childName}: {$childChildName}", $childChildValue); $fields->addFieldToTab('Root.Main', $field); } } else { $childValue = is_object($childValue) || is_array($childValue) ? json_encode($childValue) : (string) $childValue; $field = new ReadonlyField("{$childName}{$childValue}", $name . ':' . $childName, $childValue); $fields->addFieldToTab('Root.Main', $field); } } } } } return $fields; }
php
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('ParentID'); if (count($this->remoteProperties)) { $mapping = $this->editableFieldMapping(); foreach ($this->remoteProperties as $name => $value) { $field = null; if (isset($mapping[$name])) { $field = $mapping[$name]; if (is_string($field)) { $field = new $field($name, $this->fieldLabel($name), $value); $fields->addFieldToTab('Root.Main', $field); } } else if(!is_object($value) && !is_array($value)){ $value = (string) $value; $field = new ReadonlyField($name, _t('ExternalContentItem.' . $name, $name), $value); $fields->addFieldToTab('Root.Main', $field); } else if(is_object($value) || is_array($value)){ foreach($value as $childName => $childValue) { if(is_object($childValue)) { foreach($childValue as $childChildName => $childChildValue) { $childChildValue = is_object($childChildValue) || is_array($childChildValue) ? json_encode($childChildValue) : (string) $childChildValue; $field = new ReadonlyField("{$childName}{$childChildName}", "{$childName}: {$childChildName}", $childChildValue); $fields->addFieldToTab('Root.Main', $field); } } else { $childValue = is_object($childValue) || is_array($childValue) ? json_encode($childValue) : (string) $childValue; $field = new ReadonlyField("{$childName}{$childValue}", $name . ':' . $childName, $childValue); $fields->addFieldToTab('Root.Main', $field); } } } } } return $fields; }
[ "public", "function", "getCMSFields", "(", ")", "{", "$", "fields", "=", "parent", "::", "getCMSFields", "(", ")", ";", "$", "fields", "->", "removeByName", "(", "'ParentID'", ")", ";", "if", "(", "count", "(", "$", "this", "->", "remoteProperties", ")", ")", "{", "$", "mapping", "=", "$", "this", "->", "editableFieldMapping", "(", ")", ";", "foreach", "(", "$", "this", "->", "remoteProperties", "as", "$", "name", "=>", "$", "value", ")", "{", "$", "field", "=", "null", ";", "if", "(", "isset", "(", "$", "mapping", "[", "$", "name", "]", ")", ")", "{", "$", "field", "=", "$", "mapping", "[", "$", "name", "]", ";", "if", "(", "is_string", "(", "$", "field", ")", ")", "{", "$", "field", "=", "new", "$", "field", "(", "$", "name", ",", "$", "this", "->", "fieldLabel", "(", "$", "name", ")", ",", "$", "value", ")", ";", "$", "fields", "->", "addFieldToTab", "(", "'Root.Main'", ",", "$", "field", ")", ";", "}", "}", "else", "if", "(", "!", "is_object", "(", "$", "value", ")", "&&", "!", "is_array", "(", "$", "value", ")", ")", "{", "$", "value", "=", "(", "string", ")", "$", "value", ";", "$", "field", "=", "new", "ReadonlyField", "(", "$", "name", ",", "_t", "(", "'ExternalContentItem.'", ".", "$", "name", ",", "$", "name", ")", ",", "$", "value", ")", ";", "$", "fields", "->", "addFieldToTab", "(", "'Root.Main'", ",", "$", "field", ")", ";", "}", "else", "if", "(", "is_object", "(", "$", "value", ")", "||", "is_array", "(", "$", "value", ")", ")", "{", "foreach", "(", "$", "value", "as", "$", "childName", "=>", "$", "childValue", ")", "{", "if", "(", "is_object", "(", "$", "childValue", ")", ")", "{", "foreach", "(", "$", "childValue", "as", "$", "childChildName", "=>", "$", "childChildValue", ")", "{", "$", "childChildValue", "=", "is_object", "(", "$", "childChildValue", ")", "||", "is_array", "(", "$", "childChildValue", ")", "?", "json_encode", "(", "$", "childChildValue", ")", ":", "(", "string", ")", "$", "childChildValue", ";", "$", "field", "=", "new", "ReadonlyField", "(", "\"{$childName}{$childChildName}\"", ",", "\"{$childName}: {$childChildName}\"", ",", "$", "childChildValue", ")", ";", "$", "fields", "->", "addFieldToTab", "(", "'Root.Main'", ",", "$", "field", ")", ";", "}", "}", "else", "{", "$", "childValue", "=", "is_object", "(", "$", "childValue", ")", "||", "is_array", "(", "$", "childValue", ")", "?", "json_encode", "(", "$", "childValue", ")", ":", "(", "string", ")", "$", "childValue", ";", "$", "field", "=", "new", "ReadonlyField", "(", "\"{$childName}{$childValue}\"", ",", "$", "name", ".", "':'", ".", "$", "childName", ",", "$", "childValue", ")", ";", "$", "fields", "->", "addFieldToTab", "(", "'Root.Main'", ",", "$", "field", ")", ";", "}", "}", "}", "}", "}", "return", "$", "fields", ";", "}" ]
For now just show a field that says this can't be edited @see sapphire/core/model/DataObject#getCMSFields($params)
[ "For", "now", "just", "show", "a", "field", "that", "says", "this", "can", "t", "be", "edited" ]
train
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/code/model/ExternalContentItem.php#L265-L303
nyeholt/silverstripe-external-content
code/model/ExternalContentItem.php
ExternalContentItem.setCastedField
function setCastedField($fieldName, $val) { $mapping = $this->editableFieldMapping(); if (isset($mapping[$fieldName])) { $this->$fieldName = $val; } }
php
function setCastedField($fieldName, $val) { $mapping = $this->editableFieldMapping(); if (isset($mapping[$fieldName])) { $this->$fieldName = $val; } }
[ "function", "setCastedField", "(", "$", "fieldName", ",", "$", "val", ")", "{", "$", "mapping", "=", "$", "this", "->", "editableFieldMapping", "(", ")", ";", "if", "(", "isset", "(", "$", "mapping", "[", "$", "fieldName", "]", ")", ")", "{", "$", "this", "->", "$", "fieldName", "=", "$", "val", ";", "}", "}" ]
Save content from a form into a field on this data object. Since the data comes straight from a form it can't be trusted and will need to be validated / escaped.'
[ "Save", "content", "from", "a", "form", "into", "a", "field", "on", "this", "data", "object", ".", "Since", "the", "data", "comes", "straight", "from", "a", "form", "it", "can", "t", "be", "trusted", "and", "will", "need", "to", "be", "validated", "/", "escaped", "." ]
train
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/code/model/ExternalContentItem.php#L461-L466
nyeholt/silverstripe-external-content
code/model/ExternalContentItem.php
ExternalContentItem.getTreeTitle
function getTreeTitle() { $title = $this->Title; if (!$title) { $title = $this->Name; } $treeTitle = sprintf( "<span class=\"jstree-pageicon\"></span><span class=\"item\">%s</span>", Convert::raw2xml(str_replace(array("\n","\r"),"", $title)) ); return $treeTitle; }
php
function getTreeTitle() { $title = $this->Title; if (!$title) { $title = $this->Name; } $treeTitle = sprintf( "<span class=\"jstree-pageicon\"></span><span class=\"item\">%s</span>", Convert::raw2xml(str_replace(array("\n","\r"),"", $title)) ); return $treeTitle; }
[ "function", "getTreeTitle", "(", ")", "{", "$", "title", "=", "$", "this", "->", "Title", ";", "if", "(", "!", "$", "title", ")", "{", "$", "title", "=", "$", "this", "->", "Name", ";", "}", "$", "treeTitle", "=", "sprintf", "(", "\"<span class=\\\"jstree-pageicon\\\"></span><span class=\\\"item\\\">%s</span>\"", ",", "Convert", "::", "raw2xml", "(", "str_replace", "(", "array", "(", "\"\\n\"", ",", "\"\\r\"", ")", ",", "\"\"", ",", "$", "title", ")", ")", ")", ";", "return", "$", "treeTitle", ";", "}" ]
getTreeTitle will return two <span> html DOM elements, an empty <span> with the class 'jstree-pageicon' in front, following by a <span> wrapping around its MenutTitle @return string a html string ready to be directly used in a template
[ "getTreeTitle", "will", "return", "two", "<span", ">", "html", "DOM", "elements", "an", "empty", "<span", ">", "with", "the", "class", "jstree", "-", "pageicon", "in", "front", "following", "by", "a", "<span", ">", "wrapping", "around", "its", "MenutTitle" ]
train
https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/code/model/ExternalContentItem.php#L498-L509
Double-Opt-in/php-client-api
src/Config/ConfigFactory.php
ConfigFactory.fromArray
public static function fromArray(array $data) { if ( ! array_key_exists('client_id', $data)) throw new ClientConfigurationException('Configuration file has no client_id set'); if ( ! array_key_exists('client_secret', $data)) throw new ClientConfigurationException('Configuration file has no client_secret set'); if ( ! array_key_exists('site_token', $data)) throw new ClientConfigurationException('Configuration file has no site_token set'); $baseUrl = ( ! array_key_exists('api', $data)) ? null : $data['api']; $httpClientConfig = ( ! array_key_exists('http_client', $data)) ? array() : $data['http_client']; $clientConfig = new ClientConfig($data['client_id'], $data['client_secret'], $data['site_token'], $baseUrl, $httpClientConfig); if (array_key_exists('cache_file', $data)) $clientConfig->setAccessTokenCacheFile($data['cache_file']); return $clientConfig; }
php
public static function fromArray(array $data) { if ( ! array_key_exists('client_id', $data)) throw new ClientConfigurationException('Configuration file has no client_id set'); if ( ! array_key_exists('client_secret', $data)) throw new ClientConfigurationException('Configuration file has no client_secret set'); if ( ! array_key_exists('site_token', $data)) throw new ClientConfigurationException('Configuration file has no site_token set'); $baseUrl = ( ! array_key_exists('api', $data)) ? null : $data['api']; $httpClientConfig = ( ! array_key_exists('http_client', $data)) ? array() : $data['http_client']; $clientConfig = new ClientConfig($data['client_id'], $data['client_secret'], $data['site_token'], $baseUrl, $httpClientConfig); if (array_key_exists('cache_file', $data)) $clientConfig->setAccessTokenCacheFile($data['cache_file']); return $clientConfig; }
[ "public", "static", "function", "fromArray", "(", "array", "$", "data", ")", "{", "if", "(", "!", "array_key_exists", "(", "'client_id'", ",", "$", "data", ")", ")", "throw", "new", "ClientConfigurationException", "(", "'Configuration file has no client_id set'", ")", ";", "if", "(", "!", "array_key_exists", "(", "'client_secret'", ",", "$", "data", ")", ")", "throw", "new", "ClientConfigurationException", "(", "'Configuration file has no client_secret set'", ")", ";", "if", "(", "!", "array_key_exists", "(", "'site_token'", ",", "$", "data", ")", ")", "throw", "new", "ClientConfigurationException", "(", "'Configuration file has no site_token set'", ")", ";", "$", "baseUrl", "=", "(", "!", "array_key_exists", "(", "'api'", ",", "$", "data", ")", ")", "?", "null", ":", "$", "data", "[", "'api'", "]", ";", "$", "httpClientConfig", "=", "(", "!", "array_key_exists", "(", "'http_client'", ",", "$", "data", ")", ")", "?", "array", "(", ")", ":", "$", "data", "[", "'http_client'", "]", ";", "$", "clientConfig", "=", "new", "ClientConfig", "(", "$", "data", "[", "'client_id'", "]", ",", "$", "data", "[", "'client_secret'", "]", ",", "$", "data", "[", "'site_token'", "]", ",", "$", "baseUrl", ",", "$", "httpClientConfig", ")", ";", "if", "(", "array_key_exists", "(", "'cache_file'", ",", "$", "data", ")", ")", "$", "clientConfig", "->", "setAccessTokenCacheFile", "(", "$", "data", "[", "'cache_file'", "]", ")", ";", "return", "$", "clientConfig", ";", "}" ]
creates a configuration from array array( 'api' => '', // optional 'client_id' => '...', 'client_secret' => '...', 'site_token' => '', 'cache_file' => '..', ) @param array $data @return ClientConfig @throws ClientConfigurationException
[ "creates", "a", "configuration", "from", "array" ]
train
https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Config/ConfigFactory.php#L30-L53
Double-Opt-in/php-client-api
src/Config/ConfigFactory.php
ConfigFactory.fromFile
public static function fromFile($filename) { $filename = realpath($filename); if ($filename === false) throw new ClientConfigurationException('Configuration file ' . $filename . ' does not exists'); return static::fromArray(include $filename); }
php
public static function fromFile($filename) { $filename = realpath($filename); if ($filename === false) throw new ClientConfigurationException('Configuration file ' . $filename . ' does not exists'); return static::fromArray(include $filename); }
[ "public", "static", "function", "fromFile", "(", "$", "filename", ")", "{", "$", "filename", "=", "realpath", "(", "$", "filename", ")", ";", "if", "(", "$", "filename", "===", "false", ")", "throw", "new", "ClientConfigurationException", "(", "'Configuration file '", ".", "$", "filename", ".", "' does not exists'", ")", ";", "return", "static", "::", "fromArray", "(", "include", "$", "filename", ")", ";", "}" ]
creates a configuration from a php file returning an array @param string $filename @return ClientConfig @throws ClientConfigurationException
[ "creates", "a", "configuration", "from", "a", "php", "file", "returning", "an", "array" ]
train
https://github.com/Double-Opt-in/php-client-api/blob/2f17da58ec20a408bbd55b2cdd053bc689f995f4/src/Config/ConfigFactory.php#L63-L70
aedart/laravel-helpers
src/Traits/Database/SchemaTrait.php
SchemaTrait.getSchema
public function getSchema(): ?Builder { if (!$this->hasSchema()) { $this->setSchema($this->getDefaultSchema()); } return $this->schema; }
php
public function getSchema(): ?Builder { if (!$this->hasSchema()) { $this->setSchema($this->getDefaultSchema()); } return $this->schema; }
[ "public", "function", "getSchema", "(", ")", ":", "?", "Builder", "{", "if", "(", "!", "$", "this", "->", "hasSchema", "(", ")", ")", "{", "$", "this", "->", "setSchema", "(", "$", "this", "->", "getDefaultSchema", "(", ")", ")", ";", "}", "return", "$", "this", "->", "schema", ";", "}" ]
Get schema If no schema has been set, this method will set and return a default schema, if any such value is available @see getDefaultSchema() @return Builder|null schema or null if none schema has been set
[ "Get", "schema" ]
train
https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Database/SchemaTrait.php#L54-L60
aedart/laravel-helpers
src/Traits/Database/SchemaTrait.php
SchemaTrait.getDefaultSchema
public function getDefaultSchema(): ?Builder { // By default, the schema facade depends upon a // database connection being available. Therefore, // we need to ensure that this is true, before // attempting to return the facade-root $manager = DB::getFacadeRoot(); if (isset($manager) && ! is_null($manager->connection())) { return Schema::getFacadeRoot(); } return $manager; }
php
public function getDefaultSchema(): ?Builder { // By default, the schema facade depends upon a // database connection being available. Therefore, // we need to ensure that this is true, before // attempting to return the facade-root $manager = DB::getFacadeRoot(); if (isset($manager) && ! is_null($manager->connection())) { return Schema::getFacadeRoot(); } return $manager; }
[ "public", "function", "getDefaultSchema", "(", ")", ":", "?", "Builder", "{", "// By default, the schema facade depends upon a", "// database connection being available. Therefore,", "// we need to ensure that this is true, before", "// attempting to return the facade-root", "$", "manager", "=", "DB", "::", "getFacadeRoot", "(", ")", ";", "if", "(", "isset", "(", "$", "manager", ")", "&&", "!", "is_null", "(", "$", "manager", "->", "connection", "(", ")", ")", ")", "{", "return", "Schema", "::", "getFacadeRoot", "(", ")", ";", "}", "return", "$", "manager", ";", "}" ]
Get a default schema value, if any is available @return Builder|null A default schema value or Null if no default value is available
[ "Get", "a", "default", "schema", "value", "if", "any", "is", "available" ]
train
https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Database/SchemaTrait.php#L77-L88
yuncms/framework
src/notifications/migrations/m180410_092547_create_notification_settings_table.php
m180410_092547_create_notification_settings_table.safeUp
public function safeUp() { $tableOptions = null; if ($this->db->driverName === 'mysql') { // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB'; } $this->createTable($this->tableName, [ 'user_id' => $this->integer()->unsigned()->notNull()->comment('User Id'), 'category' => $this->string(200)->notNull()->comment('Category'), 'screen' => $this->boolean()->defaultValue(true)->comment('Screen'), 'email' => $this->boolean()->defaultValue(true)->comment('Email'), 'sms' => $this->boolean()->defaultValue(true)->comment('Sms'), 'app' => $this->boolean()->defaultValue(true)->comment('App'), 'updated_at' => $this->integer(10)->unsigned()->notNull()->comment('Updated At'), ], $tableOptions); $this->addPrimaryKey('notification_settings_pk', $this->tableName, 'user_id'); $this->createIndex('notification_settings_index', $this->tableName, ['user_id', 'category'], true); $this->addForeignKey('notification_settings_fk_1', $this->tableName, 'user_id', '{{%user}}', 'id', 'CASCADE', 'CASCADE'); }
php
public function safeUp() { $tableOptions = null; if ($this->db->driverName === 'mysql') { // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB'; } $this->createTable($this->tableName, [ 'user_id' => $this->integer()->unsigned()->notNull()->comment('User Id'), 'category' => $this->string(200)->notNull()->comment('Category'), 'screen' => $this->boolean()->defaultValue(true)->comment('Screen'), 'email' => $this->boolean()->defaultValue(true)->comment('Email'), 'sms' => $this->boolean()->defaultValue(true)->comment('Sms'), 'app' => $this->boolean()->defaultValue(true)->comment('App'), 'updated_at' => $this->integer(10)->unsigned()->notNull()->comment('Updated At'), ], $tableOptions); $this->addPrimaryKey('notification_settings_pk', $this->tableName, 'user_id'); $this->createIndex('notification_settings_index', $this->tableName, ['user_id', 'category'], true); $this->addForeignKey('notification_settings_fk_1', $this->tableName, 'user_id', '{{%user}}', 'id', 'CASCADE', 'CASCADE'); }
[ "public", "function", "safeUp", "(", ")", "{", "$", "tableOptions", "=", "null", ";", "if", "(", "$", "this", "->", "db", "->", "driverName", "===", "'mysql'", ")", "{", "// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci", "$", "tableOptions", "=", "'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB'", ";", "}", "$", "this", "->", "createTable", "(", "$", "this", "->", "tableName", ",", "[", "'user_id'", "=>", "$", "this", "->", "integer", "(", ")", "->", "unsigned", "(", ")", "->", "notNull", "(", ")", "->", "comment", "(", "'User Id'", ")", ",", "'category'", "=>", "$", "this", "->", "string", "(", "200", ")", "->", "notNull", "(", ")", "->", "comment", "(", "'Category'", ")", ",", "'screen'", "=>", "$", "this", "->", "boolean", "(", ")", "->", "defaultValue", "(", "true", ")", "->", "comment", "(", "'Screen'", ")", ",", "'email'", "=>", "$", "this", "->", "boolean", "(", ")", "->", "defaultValue", "(", "true", ")", "->", "comment", "(", "'Email'", ")", ",", "'sms'", "=>", "$", "this", "->", "boolean", "(", ")", "->", "defaultValue", "(", "true", ")", "->", "comment", "(", "'Sms'", ")", ",", "'app'", "=>", "$", "this", "->", "boolean", "(", ")", "->", "defaultValue", "(", "true", ")", "->", "comment", "(", "'App'", ")", ",", "'updated_at'", "=>", "$", "this", "->", "integer", "(", "10", ")", "->", "unsigned", "(", ")", "->", "notNull", "(", ")", "->", "comment", "(", "'Updated At'", ")", ",", "]", ",", "$", "tableOptions", ")", ";", "$", "this", "->", "addPrimaryKey", "(", "'notification_settings_pk'", ",", "$", "this", "->", "tableName", ",", "'user_id'", ")", ";", "$", "this", "->", "createIndex", "(", "'notification_settings_index'", ",", "$", "this", "->", "tableName", ",", "[", "'user_id'", ",", "'category'", "]", ",", "true", ")", ";", "$", "this", "->", "addForeignKey", "(", "'notification_settings_fk_1'", ",", "$", "this", "->", "tableName", ",", "'user_id'", ",", "'{{%user}}'", ",", "'id'", ",", "'CASCADE'", ",", "'CASCADE'", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/notifications/migrations/m180410_092547_create_notification_settings_table.php#L18-L37
phrest/sdk
src/Request/RequestOptions.php
RequestOptions.addParameter
public function addParameter($param, $value = true) { if (!is_scalar($param)) { throw new \Exception("Parameter filter must be scalar"); } if (!isset($this->parameters)) { $this->parameters = []; } return $this->addGetParam($param, $value); }
php
public function addParameter($param, $value = true) { if (!is_scalar($param)) { throw new \Exception("Parameter filter must be scalar"); } if (!isset($this->parameters)) { $this->parameters = []; } return $this->addGetParam($param, $value); }
[ "public", "function", "addParameter", "(", "$", "param", ",", "$", "value", "=", "true", ")", "{", "if", "(", "!", "is_scalar", "(", "$", "param", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "\"Parameter filter must be scalar\"", ")", ";", "}", "if", "(", "!", "isset", "(", "$", "this", "->", "parameters", ")", ")", "{", "$", "this", "->", "parameters", "=", "[", "]", ";", "}", "return", "$", "this", "->", "addGetParam", "(", "$", "param", ",", "$", "value", ")", ";", "}" ]
Use addGetParam/addPostParam accordingly @param $param @param bool $value @return $this @throws \Exception @deprecated
[ "Use", "addGetParam", "/", "addPostParam", "accordingly" ]
train
https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/Request/RequestOptions.php#L32-L45
phrest/sdk
src/Request/RequestOptions.php
RequestOptions.addGetParam
public function addGetParam($param, $value = true) { // Validate if (!is_scalar($param)) { throw new \Exception("Param name must be scalar"); } // Filter if (is_string($value)) { $value = trim($value); } // Set $this->queryParams[trim($param)] = $value; return $this; }
php
public function addGetParam($param, $value = true) { // Validate if (!is_scalar($param)) { throw new \Exception("Param name must be scalar"); } // Filter if (is_string($value)) { $value = trim($value); } // Set $this->queryParams[trim($param)] = $value; return $this; }
[ "public", "function", "addGetParam", "(", "$", "param", ",", "$", "value", "=", "true", ")", "{", "// Validate", "if", "(", "!", "is_scalar", "(", "$", "param", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "\"Param name must be scalar\"", ")", ";", "}", "// Filter", "if", "(", "is_string", "(", "$", "value", ")", ")", "{", "$", "value", "=", "trim", "(", "$", "value", ")", ";", "}", "// Set", "$", "this", "->", "queryParams", "[", "trim", "(", "$", "param", ")", "]", "=", "$", "value", ";", "return", "$", "this", ";", "}" ]
Add a GET parameter @param $param @param mixed $value @return $this @throws \Exception
[ "Add", "a", "GET", "parameter" ]
train
https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/Request/RequestOptions.php#L70-L88
phrest/sdk
src/Request/RequestOptions.php
RequestOptions.addPostParam
public function addPostParam($param, $value = true) { // Validate if (!is_scalar($param)) { throw new \Exception("Param name must be scalar"); } // Filter if (is_string($value)) { $value = trim($value); } // Set $this->postParams[trim($param)] = $value; return $this; }
php
public function addPostParam($param, $value = true) { // Validate if (!is_scalar($param)) { throw new \Exception("Param name must be scalar"); } // Filter if (is_string($value)) { $value = trim($value); } // Set $this->postParams[trim($param)] = $value; return $this; }
[ "public", "function", "addPostParam", "(", "$", "param", ",", "$", "value", "=", "true", ")", "{", "// Validate", "if", "(", "!", "is_scalar", "(", "$", "param", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "\"Param name must be scalar\"", ")", ";", "}", "// Filter", "if", "(", "is_string", "(", "$", "value", ")", ")", "{", "$", "value", "=", "trim", "(", "$", "value", ")", ";", "}", "// Set", "$", "this", "->", "postParams", "[", "trim", "(", "$", "param", ")", "]", "=", "$", "value", ";", "return", "$", "this", ";", "}" ]
Add a POST parameter @param $param @param bool $value @return $this @throws \Exception
[ "Add", "a", "POST", "parameter" ]
train
https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/Request/RequestOptions.php#L99-L117
phrest/sdk
src/Request/RequestOptions.php
RequestOptions.setSearchTerm
public function setSearchTerm($searchTerm) { if (!is_scalar($searchTerm)) { throw new \Exception("Search term must be a string"); } $this->searchTerm = trim($searchTerm); return $this; }
php
public function setSearchTerm($searchTerm) { if (!is_scalar($searchTerm)) { throw new \Exception("Search term must be a string"); } $this->searchTerm = trim($searchTerm); return $this; }
[ "public", "function", "setSearchTerm", "(", "$", "searchTerm", ")", "{", "if", "(", "!", "is_scalar", "(", "$", "searchTerm", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "\"Search term must be a string\"", ")", ";", "}", "$", "this", "->", "searchTerm", "=", "trim", "(", "$", "searchTerm", ")", ";", "return", "$", "this", ";", "}" ]
Set a search term for the request @param $searchTerm @return $this @throws \Exception
[ "Set", "a", "search", "term", "for", "the", "request" ]
train
https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/Request/RequestOptions.php#L137-L147
phrest/sdk
src/Request/RequestOptions.php
RequestOptions.getGetParams
public function getGetParams() { if (isset($this->searchTerm)) { $this->queryParams['q'] = $this->searchTerm; } return $this->queryParams; }
php
public function getGetParams() { if (isset($this->searchTerm)) { $this->queryParams['q'] = $this->searchTerm; } return $this->queryParams; }
[ "public", "function", "getGetParams", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "searchTerm", ")", ")", "{", "$", "this", "->", "queryParams", "[", "'q'", "]", "=", "$", "this", "->", "searchTerm", ";", "}", "return", "$", "this", "->", "queryParams", ";", "}" ]
Get the request GET params @return array
[ "Get", "the", "request", "GET", "params" ]
train
https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/Request/RequestOptions.php#L166-L174
phrest/sdk
src/Request/RequestOptions.php
RequestOptions.toArray
public function toArray() { $params = []; if (isset($this->searchTerm)) { $params['q'] = $this->searchTerm; } if (isset($this->parameters)) { foreach ($this->parameters as $paramKey => $paramVal) { $params[$paramKey] = $paramVal; } } return $params; }
php
public function toArray() { $params = []; if (isset($this->searchTerm)) { $params['q'] = $this->searchTerm; } if (isset($this->parameters)) { foreach ($this->parameters as $paramKey => $paramVal) { $params[$paramKey] = $paramVal; } } return $params; }
[ "public", "function", "toArray", "(", ")", "{", "$", "params", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "this", "->", "searchTerm", ")", ")", "{", "$", "params", "[", "'q'", "]", "=", "$", "this", "->", "searchTerm", ";", "}", "if", "(", "isset", "(", "$", "this", "->", "parameters", ")", ")", "{", "foreach", "(", "$", "this", "->", "parameters", "as", "$", "paramKey", "=>", "$", "paramVal", ")", "{", "$", "params", "[", "$", "paramKey", "]", "=", "$", "paramVal", ";", "}", "}", "return", "$", "params", ";", "}" ]
This should no longer be needed todo remove @return array @deprecated
[ "This", "should", "no", "longer", "be", "needed", "todo", "remove" ]
train
https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/Request/RequestOptions.php#L193-L211
mgallegos/decima-file
src/Mgallegos/DecimaFile/File/Repositories/File/EloquentFile.php
EloquentFile.byTypeAndByOrganization
public function byTypeAndByOrganization($type , $organizationId, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } return $this->File->setConnection($databaseConnectionName) ->where('type', '=', $type) ->where('organization_id', '=', $organizationId) ->get(); }
php
public function byTypeAndByOrganization($type , $organizationId, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } return $this->File->setConnection($databaseConnectionName) ->where('type', '=', $type) ->where('organization_id', '=', $organizationId) ->get(); }
[ "public", "function", "byTypeAndByOrganization", "(", "$", "type", ",", "$", "organizationId", ",", "$", "databaseConnectionName", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "databaseConnectionName", ")", ")", "{", "$", "databaseConnectionName", "=", "$", "this", "->", "databaseConnectionName", ";", "}", "return", "$", "this", "->", "File", "->", "setConnection", "(", "$", "databaseConnectionName", ")", "->", "where", "(", "'type'", ",", "'='", ",", "$", "type", ")", "->", "where", "(", "'organization_id'", ",", "'='", ",", "$", "organizationId", ")", "->", "get", "(", ")", ";", "}" ]
Retrieve ... by organization @param int $id Organization id @return Illuminate\Database\Eloquent\Collection
[ "Retrieve", "...", "by", "organization" ]
train
https://github.com/mgallegos/decima-file/blob/94c26ab40f5c4dd12e913e73376c24db27588f0b/src/Mgallegos/DecimaFile/File/Repositories/File/EloquentFile.php#L94-L105
mgallegos/decima-file
src/Mgallegos/DecimaFile/File/Repositories/File/EloquentFile.php
EloquentFile.byParentId
public function byParentId($id, $organizationId, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } return $this->File->setConnection($databaseConnectionName) ->where('parent_file_id', '=', $id) ->where('organization_id', '=', $organizationId) ->get(); }
php
public function byParentId($id, $organizationId, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } return $this->File->setConnection($databaseConnectionName) ->where('parent_file_id', '=', $id) ->where('organization_id', '=', $organizationId) ->get(); }
[ "public", "function", "byParentId", "(", "$", "id", ",", "$", "organizationId", ",", "$", "databaseConnectionName", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "databaseConnectionName", ")", ")", "{", "$", "databaseConnectionName", "=", "$", "this", "->", "databaseConnectionName", ";", "}", "return", "$", "this", "->", "File", "->", "setConnection", "(", "$", "databaseConnectionName", ")", "->", "where", "(", "'parent_file_id'", ",", "'='", ",", "$", "id", ")", "->", "where", "(", "'organization_id'", ",", "'='", ",", "$", "organizationId", ")", "->", "get", "(", ")", ";", "}" ]
Retrieve ... by parent @param int $id parent id @return Illuminate\Database\Eloquent\Collection
[ "Retrieve", "...", "by", "parent" ]
train
https://github.com/mgallegos/decima-file/blob/94c26ab40f5c4dd12e913e73376c24db27588f0b/src/Mgallegos/DecimaFile/File/Repositories/File/EloquentFile.php#L114-L125
mgallegos/decima-file
src/Mgallegos/DecimaFile/File/Repositories/File/EloquentFile.php
EloquentFile.byParentByFolderNameAndByOrganization
public function byParentByFolderNameAndByOrganization($parentId , $parent_name , $organizationId, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } return $this->File->setConnection($databaseConnectionName) ->where('type', '=', 'C') ->where('parent_file_id', '=' , $parentId) ->where('name', '=', $parent_name) ->where('organization_id', '=', $organizationId) ->get(); }
php
public function byParentByFolderNameAndByOrganization($parentId , $parent_name , $organizationId, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } return $this->File->setConnection($databaseConnectionName) ->where('type', '=', 'C') ->where('parent_file_id', '=' , $parentId) ->where('name', '=', $parent_name) ->where('organization_id', '=', $organizationId) ->get(); }
[ "public", "function", "byParentByFolderNameAndByOrganization", "(", "$", "parentId", ",", "$", "parent_name", ",", "$", "organizationId", ",", "$", "databaseConnectionName", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "databaseConnectionName", ")", ")", "{", "$", "databaseConnectionName", "=", "$", "this", "->", "databaseConnectionName", ";", "}", "return", "$", "this", "->", "File", "->", "setConnection", "(", "$", "databaseConnectionName", ")", "->", "where", "(", "'type'", ",", "'='", ",", "'C'", ")", "->", "where", "(", "'parent_file_id'", ",", "'='", ",", "$", "parentId", ")", "->", "where", "(", "'name'", ",", "'='", ",", "$", "parent_name", ")", "->", "where", "(", "'organization_id'", ",", "'='", ",", "$", "organizationId", ")", "->", "get", "(", ")", ";", "}" ]
Retrieve ... by parent @param int $id parent id @return Illuminate\Database\Eloquent\Collection
[ "Retrieve", "...", "by", "parent" ]
train
https://github.com/mgallegos/decima-file/blob/94c26ab40f5c4dd12e913e73376c24db27588f0b/src/Mgallegos/DecimaFile/File/Repositories/File/EloquentFile.php#L154-L167
mgallegos/decima-file
src/Mgallegos/DecimaFile/File/Repositories/File/EloquentFile.php
EloquentFile.byFileNameAndByOrganization
public function byFileNameAndByOrganization($file_name, $organizationId, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } return $this->File->setConnection($databaseConnectionName) ->where('name', '=', $file_name) ->where('organization_id', '=', $organizationId) ->get(); }
php
public function byFileNameAndByOrganization($file_name, $organizationId, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } return $this->File->setConnection($databaseConnectionName) ->where('name', '=', $file_name) ->where('organization_id', '=', $organizationId) ->get(); }
[ "public", "function", "byFileNameAndByOrganization", "(", "$", "file_name", ",", "$", "organizationId", ",", "$", "databaseConnectionName", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "databaseConnectionName", ")", ")", "{", "$", "databaseConnectionName", "=", "$", "this", "->", "databaseConnectionName", ";", "}", "return", "$", "this", "->", "File", "->", "setConnection", "(", "$", "databaseConnectionName", ")", "->", "where", "(", "'name'", ",", "'='", ",", "$", "file_name", ")", "->", "where", "(", "'organization_id'", ",", "'='", ",", "$", "organizationId", ")", "->", "get", "(", ")", ";", "}" ]
Retrieve ... by parent @param int $id parent id @return Illuminate\Database\Eloquent\Collection
[ "Retrieve", "...", "by", "parent" ]
train
https://github.com/mgallegos/decima-file/blob/94c26ab40f5c4dd12e913e73376c24db27588f0b/src/Mgallegos/DecimaFile/File/Repositories/File/EloquentFile.php#L176-L187
mgallegos/decima-file
src/Mgallegos/DecimaFile/File/Repositories/File/EloquentFile.php
EloquentFile.byKeyAndPublic
public function byKeyAndPublic($key, $isPublic, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } return $this->File->setConnection($databaseConnectionName) ->where('key', '=', $key) ->where('is_public', '=', $isPublic) ->get(); }
php
public function byKeyAndPublic($key, $isPublic, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } return $this->File->setConnection($databaseConnectionName) ->where('key', '=', $key) ->where('is_public', '=', $isPublic) ->get(); }
[ "public", "function", "byKeyAndPublic", "(", "$", "key", ",", "$", "isPublic", ",", "$", "databaseConnectionName", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "databaseConnectionName", ")", ")", "{", "$", "databaseConnectionName", "=", "$", "this", "->", "databaseConnectionName", ";", "}", "return", "$", "this", "->", "File", "->", "setConnection", "(", "$", "databaseConnectionName", ")", "->", "where", "(", "'key'", ",", "'='", ",", "$", "key", ")", "->", "where", "(", "'is_public'", ",", "'='", ",", "$", "isPublic", ")", "->", "get", "(", ")", ";", "}" ]
Retrieve ... by parent @param int $id parent id @return Illuminate\Database\Eloquent\Collection
[ "Retrieve", "...", "by", "parent" ]
train
https://github.com/mgallegos/decima-file/blob/94c26ab40f5c4dd12e913e73376c24db27588f0b/src/Mgallegos/DecimaFile/File/Repositories/File/EloquentFile.php#L196-L207
mgallegos/decima-file
src/Mgallegos/DecimaFile/File/Repositories/File/EloquentFile.php
EloquentFile.bySystemReferenceTypeBySystemReferenceIdAndByOrganization
public function bySystemReferenceTypeBySystemReferenceIdAndByOrganization($systemReferenceType , $systemReferenceId, $organizationId, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } return $this->File->setConnection($databaseConnectionName) ->where('system_reference_type', '=', $systemReferenceType) ->where('system_reference_id', '=', $systemReferenceId) ->where('organization_id', '=', $organizationId) ->get(); }
php
public function bySystemReferenceTypeBySystemReferenceIdAndByOrganization($systemReferenceType , $systemReferenceId, $organizationId, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } return $this->File->setConnection($databaseConnectionName) ->where('system_reference_type', '=', $systemReferenceType) ->where('system_reference_id', '=', $systemReferenceId) ->where('organization_id', '=', $organizationId) ->get(); }
[ "public", "function", "bySystemReferenceTypeBySystemReferenceIdAndByOrganization", "(", "$", "systemReferenceType", ",", "$", "systemReferenceId", ",", "$", "organizationId", ",", "$", "databaseConnectionName", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "databaseConnectionName", ")", ")", "{", "$", "databaseConnectionName", "=", "$", "this", "->", "databaseConnectionName", ";", "}", "return", "$", "this", "->", "File", "->", "setConnection", "(", "$", "databaseConnectionName", ")", "->", "where", "(", "'system_reference_type'", ",", "'='", ",", "$", "systemReferenceType", ")", "->", "where", "(", "'system_reference_id'", ",", "'='", ",", "$", "systemReferenceId", ")", "->", "where", "(", "'organization_id'", ",", "'='", ",", "$", "organizationId", ")", "->", "get", "(", ")", ";", "}" ]
Retrieve files by system reference type and system reference id @param int $id parent id @return Illuminate\Database\Eloquent\Collection
[ "Retrieve", "files", "by", "system", "reference", "type", "and", "system", "reference", "id" ]
train
https://github.com/mgallegos/decima-file/blob/94c26ab40f5c4dd12e913e73376c24db27588f0b/src/Mgallegos/DecimaFile/File/Repositories/File/EloquentFile.php#L236-L248
mgallegos/decima-file
src/Mgallegos/DecimaFile/File/Repositories/File/EloquentFile.php
EloquentFile.create
public function create(array $data, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } $File = new File(); $File->setConnection($databaseConnectionName); $File->fill($data)->save(); return $File; }
php
public function create(array $data, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } $File = new File(); $File->setConnection($databaseConnectionName); $File->fill($data)->save(); return $File; }
[ "public", "function", "create", "(", "array", "$", "data", ",", "$", "databaseConnectionName", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "databaseConnectionName", ")", ")", "{", "$", "databaseConnectionName", "=", "$", "this", "->", "databaseConnectionName", ";", "}", "$", "File", "=", "new", "File", "(", ")", ";", "$", "File", "->", "setConnection", "(", "$", "databaseConnectionName", ")", ";", "$", "File", "->", "fill", "(", "$", "data", ")", "->", "save", "(", ")", ";", "return", "$", "File", ";", "}" ]
Create a new ... @param array $data An array as follows: array('field0'=>$field0, 'field1'=>$field1 ); @return boolean
[ "Create", "a", "new", "..." ]
train
https://github.com/mgallegos/decima-file/blob/94c26ab40f5c4dd12e913e73376c24db27588f0b/src/Mgallegos/DecimaFile/File/Repositories/File/EloquentFile.php#L259-L271
mgallegos/decima-file
src/Mgallegos/DecimaFile/File/Repositories/File/EloquentFile.php
EloquentFile.update
public function update(array $data, $File = null, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } if(empty($File)) { $File = $this->byId($data['id'], $databaseConnectionName); } foreach ($data as $key => $value) { $File->$key = $value; } return $File->save(); }
php
public function update(array $data, $File = null, $databaseConnectionName = null) { if(empty($databaseConnectionName)) { $databaseConnectionName = $this->databaseConnectionName; } if(empty($File)) { $File = $this->byId($data['id'], $databaseConnectionName); } foreach ($data as $key => $value) { $File->$key = $value; } return $File->save(); }
[ "public", "function", "update", "(", "array", "$", "data", ",", "$", "File", "=", "null", ",", "$", "databaseConnectionName", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "databaseConnectionName", ")", ")", "{", "$", "databaseConnectionName", "=", "$", "this", "->", "databaseConnectionName", ";", "}", "if", "(", "empty", "(", "$", "File", ")", ")", "{", "$", "File", "=", "$", "this", "->", "byId", "(", "$", "data", "[", "'id'", "]", ",", "$", "databaseConnectionName", ")", ";", "}", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "File", "->", "$", "key", "=", "$", "value", ";", "}", "return", "$", "File", "->", "save", "(", ")", ";", "}" ]
Update an existing ... @param array $data An array as follows: array('field0'=>$field0, 'field1'=>$field1 ); @param Mgallegos\DecimaAccounting\Account $File @return boolean
[ "Update", "an", "existing", "..." ]
train
https://github.com/mgallegos/decima-file/blob/94c26ab40f5c4dd12e913e73376c24db27588f0b/src/Mgallegos/DecimaFile/File/Repositories/File/EloquentFile.php#L284-L302
webforge-labs/psc-cms
lib/Psc/UI/Component/JavaScriptBase.php
JavaScriptBase.createJooseSnippet
protected function createJooseSnippet($jooseClass, $constructParams = NULL, Array $dependencies = array()) { return JooseSnippet::create($jooseClass, $constructParams, $dependencies); }
php
protected function createJooseSnippet($jooseClass, $constructParams = NULL, Array $dependencies = array()) { return JooseSnippet::create($jooseClass, $constructParams, $dependencies); }
[ "protected", "function", "createJooseSnippet", "(", "$", "jooseClass", ",", "$", "constructParams", "=", "NULL", ",", "Array", "$", "dependencies", "=", "array", "(", ")", ")", "{", "return", "JooseSnippet", "::", "create", "(", "$", "jooseClass", ",", "$", "constructParams", ",", "$", "dependencies", ")", ";", "}" ]
Erstellt ein Snippet welches mit %self% auf die Componente als jQuery Objekt zugreifen kann @return Psc\JS\Snippet
[ "Erstellt", "ein", "Snippet", "welches", "mit", "%self%", "auf", "die", "Componente", "als", "jQuery", "Objekt", "zugreifen", "kann" ]
train
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/Component/JavaScriptBase.php#L28-L30
webforge-labs/psc-cms
lib/Psc/UI/Component/JavaScriptBase.php
JavaScriptBase.widgetSelector
protected function widgetSelector(\Psc\HTML\Tag $tag = NULL, $subSelector = NULL) { $jQuery = \Psc\JS\jQuery::getClassSelector($tag ?: $this->html); if (isset($subSelector)) { $jQuery .= sprintf(".find(%s)", \Psc\JS\Helper::convertString($subSelector)); } return $this->jsExpr($jQuery); }
php
protected function widgetSelector(\Psc\HTML\Tag $tag = NULL, $subSelector = NULL) { $jQuery = \Psc\JS\jQuery::getClassSelector($tag ?: $this->html); if (isset($subSelector)) { $jQuery .= sprintf(".find(%s)", \Psc\JS\Helper::convertString($subSelector)); } return $this->jsExpr($jQuery); }
[ "protected", "function", "widgetSelector", "(", "\\", "Psc", "\\", "HTML", "\\", "Tag", "$", "tag", "=", "NULL", ",", "$", "subSelector", "=", "NULL", ")", "{", "$", "jQuery", "=", "\\", "Psc", "\\", "JS", "\\", "jQuery", "::", "getClassSelector", "(", "$", "tag", "?", ":", "$", "this", "->", "html", ")", ";", "if", "(", "isset", "(", "$", "subSelector", ")", ")", "{", "$", "jQuery", ".=", "sprintf", "(", "\".find(%s)\"", ",", "\\", "Psc", "\\", "JS", "\\", "Helper", "::", "convertString", "(", "$", "subSelector", ")", ")", ";", "}", "return", "$", "this", "->", "jsExpr", "(", "$", "jQuery", ")", ";", "}" ]
denn das hier hat nix mit joose zu tun
[ "denn", "das", "hier", "hat", "nix", "mit", "joose", "zu", "tun" ]
train
https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/UI/Component/JavaScriptBase.php#L34-L42
steeffeen/FancyManiaLinks
FML/Script/ScriptLabel.php
ScriptLabel.getEventLabels
public static function getEventLabels() { return array(self::ENTRYSUBMIT, self::KEYPRESS, self::MOUSECLICK, self::MOUSEOUT, self::MOUSEOVER); }
php
public static function getEventLabels() { return array(self::ENTRYSUBMIT, self::KEYPRESS, self::MOUSECLICK, self::MOUSEOUT, self::MOUSEOVER); }
[ "public", "static", "function", "getEventLabels", "(", ")", "{", "return", "array", "(", "self", "::", "ENTRYSUBMIT", ",", "self", "::", "KEYPRESS", ",", "self", "::", "MOUSECLICK", ",", "self", "::", "MOUSEOUT", ",", "self", "::", "MOUSEOVER", ")", ";", "}" ]
Get the possible event label names @return string[]
[ "Get", "the", "possible", "event", "label", "names" ]
train
https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/ScriptLabel.php#L188-L191
yuncms/framework
src/admin/widgets/Toolbar.php
Toolbar.renderItems
public function renderItems() { $items = []; foreach ($this->items as $i => $item) { if (isset($item['visible']) && !$item['visible']) { continue; } $items[] = $this->renderItem($item); } return implode("\n", $items); }
php
public function renderItems() { $items = []; foreach ($this->items as $i => $item) { if (isset($item['visible']) && !$item['visible']) { continue; } $items[] = $this->renderItem($item); } return implode("\n", $items); }
[ "public", "function", "renderItems", "(", ")", "{", "$", "items", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "items", "as", "$", "i", "=>", "$", "item", ")", "{", "if", "(", "isset", "(", "$", "item", "[", "'visible'", "]", ")", "&&", "!", "$", "item", "[", "'visible'", "]", ")", "{", "continue", ";", "}", "$", "items", "[", "]", "=", "$", "this", "->", "renderItem", "(", "$", "item", ")", ";", "}", "return", "implode", "(", "\"\\n\"", ",", "$", "items", ")", ";", "}" ]
Renders widget items.
[ "Renders", "widget", "items", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/widgets/Toolbar.php#L129-L139
yuncms/framework
src/admin/widgets/Toolbar.php
Toolbar.renderItem
public function renderItem($item) { if (is_string($item)) { return $item; } if (!isset($item['label'])) { throw new InvalidConfigException("The 'label' option is required."); } $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels; $label = $encodeLabel ? Html::encode($item['label']) : $item['label']; $options = ArrayHelper::getValue($item, 'options', ['class'=>'btn btn-sm']); $url = ArrayHelper::getValue($item, 'url', '#'); if (isset($item['active'])) { $active = ArrayHelper::remove($item, 'active', false); } else { $active = $this->isItemActive($item); } if ($active) { Html::addCssClass($options, 'btn-info'); } else { Html::addCssClass($options, 'btn-default'); } return Html::a($label, $url, $options); }
php
public function renderItem($item) { if (is_string($item)) { return $item; } if (!isset($item['label'])) { throw new InvalidConfigException("The 'label' option is required."); } $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels; $label = $encodeLabel ? Html::encode($item['label']) : $item['label']; $options = ArrayHelper::getValue($item, 'options', ['class'=>'btn btn-sm']); $url = ArrayHelper::getValue($item, 'url', '#'); if (isset($item['active'])) { $active = ArrayHelper::remove($item, 'active', false); } else { $active = $this->isItemActive($item); } if ($active) { Html::addCssClass($options, 'btn-info'); } else { Html::addCssClass($options, 'btn-default'); } return Html::a($label, $url, $options); }
[ "public", "function", "renderItem", "(", "$", "item", ")", "{", "if", "(", "is_string", "(", "$", "item", ")", ")", "{", "return", "$", "item", ";", "}", "if", "(", "!", "isset", "(", "$", "item", "[", "'label'", "]", ")", ")", "{", "throw", "new", "InvalidConfigException", "(", "\"The 'label' option is required.\"", ")", ";", "}", "$", "encodeLabel", "=", "isset", "(", "$", "item", "[", "'encode'", "]", ")", "?", "$", "item", "[", "'encode'", "]", ":", "$", "this", "->", "encodeLabels", ";", "$", "label", "=", "$", "encodeLabel", "?", "Html", "::", "encode", "(", "$", "item", "[", "'label'", "]", ")", ":", "$", "item", "[", "'label'", "]", ";", "$", "options", "=", "ArrayHelper", "::", "getValue", "(", "$", "item", ",", "'options'", ",", "[", "'class'", "=>", "'btn btn-sm'", "]", ")", ";", "$", "url", "=", "ArrayHelper", "::", "getValue", "(", "$", "item", ",", "'url'", ",", "'#'", ")", ";", "if", "(", "isset", "(", "$", "item", "[", "'active'", "]", ")", ")", "{", "$", "active", "=", "ArrayHelper", "::", "remove", "(", "$", "item", ",", "'active'", ",", "false", ")", ";", "}", "else", "{", "$", "active", "=", "$", "this", "->", "isItemActive", "(", "$", "item", ")", ";", "}", "if", "(", "$", "active", ")", "{", "Html", "::", "addCssClass", "(", "$", "options", ",", "'btn-info'", ")", ";", "}", "else", "{", "Html", "::", "addCssClass", "(", "$", "options", ",", "'btn-default'", ")", ";", "}", "return", "Html", "::", "a", "(", "$", "label", ",", "$", "url", ",", "$", "options", ")", ";", "}" ]
Renders a widget's item. @param string|array $item the item to render. @return string the rendering result. @throws InvalidConfigException
[ "Renders", "a", "widget", "s", "item", "." ]
train
https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/admin/widgets/Toolbar.php#L147-L173
refinery29/league-lazy-event
src/LazyListener.php
LazyListener.getListener
public function getListener() { if ($this->listener === null) { try { $listener = $this->container->get($this->alias); } catch (Container\ContainerExceptionInterface $exception) { throw new \BadMethodCallException(sprintf( 'Unable to fetch a service for alias "%s" from the container', $this->alias )); } $this->listener = $this->ensureListener($listener); } return $this->listener; }
php
public function getListener() { if ($this->listener === null) { try { $listener = $this->container->get($this->alias); } catch (Container\ContainerExceptionInterface $exception) { throw new \BadMethodCallException(sprintf( 'Unable to fetch a service for alias "%s" from the container', $this->alias )); } $this->listener = $this->ensureListener($listener); } return $this->listener; }
[ "public", "function", "getListener", "(", ")", "{", "if", "(", "$", "this", "->", "listener", "===", "null", ")", "{", "try", "{", "$", "listener", "=", "$", "this", "->", "container", "->", "get", "(", "$", "this", "->", "alias", ")", ";", "}", "catch", "(", "Container", "\\", "ContainerExceptionInterface", "$", "exception", ")", "{", "throw", "new", "\\", "BadMethodCallException", "(", "sprintf", "(", "'Unable to fetch a service for alias \"%s\" from the container'", ",", "$", "this", "->", "alias", ")", ")", ";", "}", "$", "this", "->", "listener", "=", "$", "this", "->", "ensureListener", "(", "$", "listener", ")", ";", "}", "return", "$", "this", "->", "listener", ";", "}" ]
@throws BadMethodCallException @return ListenerInterface
[ "@throws", "BadMethodCallException" ]
train
https://github.com/refinery29/league-lazy-event/blob/6b363991f9d8e30e0912a83bf3cb0bf208066c54/src/LazyListener.php#L50-L66
refinery29/league-lazy-event
src/LazyListener.php
LazyListener.ensureListener
private function ensureListener($listener) { if ($listener instanceof ListenerInterface) { return $listener; } if (is_callable($listener)) { return CallbackListener::fromCallable($listener); } throw new \BadMethodCallException('Fetched listener neither implements ListenerInterface nor is a callable'); }
php
private function ensureListener($listener) { if ($listener instanceof ListenerInterface) { return $listener; } if (is_callable($listener)) { return CallbackListener::fromCallable($listener); } throw new \BadMethodCallException('Fetched listener neither implements ListenerInterface nor is a callable'); }
[ "private", "function", "ensureListener", "(", "$", "listener", ")", "{", "if", "(", "$", "listener", "instanceof", "ListenerInterface", ")", "{", "return", "$", "listener", ";", "}", "if", "(", "is_callable", "(", "$", "listener", ")", ")", "{", "return", "CallbackListener", "::", "fromCallable", "(", "$", "listener", ")", ";", "}", "throw", "new", "\\", "BadMethodCallException", "(", "'Fetched listener neither implements ListenerInterface nor is a callable'", ")", ";", "}" ]
@param ListenerInterface|callable $listener @throws \BadMethodCallException @return ListenerInterface
[ "@param", "ListenerInterface|callable", "$listener" ]
train
https://github.com/refinery29/league-lazy-event/blob/6b363991f9d8e30e0912a83bf3cb0bf208066c54/src/LazyListener.php#L75-L86
aedart/laravel-helpers
src/Traits/Database/DBManagerTrait.php
DBManagerTrait.getDbManager
public function getDbManager(): ?DatabaseManager { if (!$this->hasDbManager()) { $this->setDbManager($this->getDefaultDbManager()); } return $this->dbManager; }
php
public function getDbManager(): ?DatabaseManager { if (!$this->hasDbManager()) { $this->setDbManager($this->getDefaultDbManager()); } return $this->dbManager; }
[ "public", "function", "getDbManager", "(", ")", ":", "?", "DatabaseManager", "{", "if", "(", "!", "$", "this", "->", "hasDbManager", "(", ")", ")", "{", "$", "this", "->", "setDbManager", "(", "$", "this", "->", "getDefaultDbManager", "(", ")", ")", ";", "}", "return", "$", "this", "->", "dbManager", ";", "}" ]
Get db manager If no db manager has been set, this method will set and return a default db manager, if any such value is available @see getDefaultDbManager() @return DatabaseManager|null db manager or null if none db manager has been set
[ "Get", "db", "manager" ]
train
https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Database/DBManagerTrait.php#L53-L59
fyuze/framework
src/Fyuze/Http/Message/Stream.php
Stream.read
public function read($length) { if (false === $this->isReadable()) { throw new RuntimeException('The current stream is not readable.'); } // @todo find out how to make fread fail if (false === $content = fread($this->stream, $length)) { // @codeCoverageIgnoreStart throw new RuntimeException('An error occurred while reading stream.'); // @codeCoverageIgnoreEnd } return $content; }
php
public function read($length) { if (false === $this->isReadable()) { throw new RuntimeException('The current stream is not readable.'); } // @todo find out how to make fread fail if (false === $content = fread($this->stream, $length)) { // @codeCoverageIgnoreStart throw new RuntimeException('An error occurred while reading stream.'); // @codeCoverageIgnoreEnd } return $content; }
[ "public", "function", "read", "(", "$", "length", ")", "{", "if", "(", "false", "===", "$", "this", "->", "isReadable", "(", ")", ")", "{", "throw", "new", "RuntimeException", "(", "'The current stream is not readable.'", ")", ";", "}", "// @todo find out how to make fread fail", "if", "(", "false", "===", "$", "content", "=", "fread", "(", "$", "this", "->", "stream", ",", "$", "length", ")", ")", "{", "// @codeCoverageIgnoreStart", "throw", "new", "RuntimeException", "(", "'An error occurred while reading stream.'", ")", ";", "// @codeCoverageIgnoreEnd", "}", "return", "$", "content", ";", "}" ]
{@inheritdoc} @param int $length Read up to $length bytes from the object and return them. Fewer than $length bytes may be returned if underlying stream call returns fewer bytes. @return string Returns the data read from the stream, or an empty string if no bytes are available. @throws \RuntimeException if an error occurs.
[ "{", "@inheritdoc", "}" ]
train
https://github.com/fyuze/framework/blob/89b3984f7225e24bfcdafb090ee197275b3222c9/src/Fyuze/Http/Message/Stream.php#L226-L240
fyuze/framework
src/Fyuze/Http/Message/Stream.php
Stream.getMetadata
public function getMetadata($key = null) { $meta = stream_get_meta_data($this->stream); if ($key === null) { return $meta; } if (array_key_exists($key, $meta)) { return $meta[$key]; } return null; }
php
public function getMetadata($key = null) { $meta = stream_get_meta_data($this->stream); if ($key === null) { return $meta; } if (array_key_exists($key, $meta)) { return $meta[$key]; } return null; }
[ "public", "function", "getMetadata", "(", "$", "key", "=", "null", ")", "{", "$", "meta", "=", "stream_get_meta_data", "(", "$", "this", "->", "stream", ")", ";", "if", "(", "$", "key", "===", "null", ")", "{", "return", "$", "meta", ";", "}", "if", "(", "array_key_exists", "(", "$", "key", ",", "$", "meta", ")", ")", "{", "return", "$", "meta", "[", "$", "key", "]", ";", "}", "return", "null", ";", "}" ]
{@inheritdoc} @link http://php.net/manual/en/function.stream-get-meta-data.php @param string $key Specific metadata to retrieve. @return array|mixed|null Returns an associative array if no key is provided. Returns a specific key value if a key is provided and the value is found, or null if the key is not found.
[ "{", "@inheritdoc", "}" ]
train
https://github.com/fyuze/framework/blob/89b3984f7225e24bfcdafb090ee197275b3222c9/src/Fyuze/Http/Message/Stream.php#L272-L285
periaptio/empress-generator
src/Generators/ModelRelationshipsGenerator.php
ModelRelationshipsGenerator.detectOneToOne
private function detectOneToOne($constraint, $primaryColumns) { $foreignColumns = $constraint->getLocalColumns(); sort($foreignColumns); return $primaryColumns === $foreignColumns; }
php
private function detectOneToOne($constraint, $primaryColumns) { $foreignColumns = $constraint->getLocalColumns(); sort($foreignColumns); return $primaryColumns === $foreignColumns; }
[ "private", "function", "detectOneToOne", "(", "$", "constraint", ",", "$", "primaryColumns", ")", "{", "$", "foreignColumns", "=", "$", "constraint", "->", "getLocalColumns", "(", ")", ";", "sort", "(", "$", "foreignColumns", ")", ";", "return", "$", "primaryColumns", "===", "$", "foreignColumns", ";", "}" ]
if FK is also a primary key, and there is only one primary key we know this will be a one to one relationship @param object $constraint @param array $primaryFields @return boolean
[ "if", "FK", "is", "also", "a", "primary", "key", "and", "there", "is", "only", "one", "primary", "key", "we", "know", "this", "will", "be", "a", "one", "to", "one", "relationship" ]
train
https://github.com/periaptio/empress-generator/blob/749fb4b12755819e9c97377ebfb446ee0822168a/src/Generators/ModelRelationshipsGenerator.php#L183-L189
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.applyDefaultValues
public function applyDefaultValues() { $this->type = 'contao'; $this->api_auth_type = 'none'; $this->activated = false; $this->includelog = false; $this->website_hash = ''; $this->notification_recipient = ''; $this->notification_sender = ''; $this->notification_change = true; $this->notification_error = true; }
php
public function applyDefaultValues() { $this->type = 'contao'; $this->api_auth_type = 'none'; $this->activated = false; $this->includelog = false; $this->website_hash = ''; $this->notification_recipient = ''; $this->notification_sender = ''; $this->notification_change = true; $this->notification_error = true; }
[ "public", "function", "applyDefaultValues", "(", ")", "{", "$", "this", "->", "type", "=", "'contao'", ";", "$", "this", "->", "api_auth_type", "=", "'none'", ";", "$", "this", "->", "activated", "=", "false", ";", "$", "this", "->", "includelog", "=", "false", ";", "$", "this", "->", "website_hash", "=", "''", ";", "$", "this", "->", "notification_recipient", "=", "''", ";", "$", "this", "->", "notification_sender", "=", "''", ";", "$", "this", "->", "notification_change", "=", "true", ";", "$", "this", "->", "notification_error", "=", "true", ";", "}" ]
Applies default values to this object. This method should be called from the object's constructor (or equivalent initialization method). @see __construct()
[ "Applies", "default", "values", "to", "this", "object", ".", "This", "method", "should", "be", "called", "from", "the", "object", "s", "constructor", "(", "or", "equivalent", "initialization", "method", ")", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L263-L274
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.getLastRun
public function getLastRun($format = null) { if ($this->last_run === null) { return null; } if ($this->last_run === '0000-00-00 00:00:00') { // while technically this is not a default value of null, // this seems to be closest in meaning. return null; } try { $dt = new DateTime($this->last_run); } catch (Exception $x) { throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->last_run, true), $x); } if ($format === null) { // Because propel.useDateTimeClass is true, we return a DateTime object. return $dt; } if (strpos($format, '%') !== false) { return strftime($format, $dt->format('U')); } return $dt->format($format); }
php
public function getLastRun($format = null) { if ($this->last_run === null) { return null; } if ($this->last_run === '0000-00-00 00:00:00') { // while technically this is not a default value of null, // this seems to be closest in meaning. return null; } try { $dt = new DateTime($this->last_run); } catch (Exception $x) { throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->last_run, true), $x); } if ($format === null) { // Because propel.useDateTimeClass is true, we return a DateTime object. return $dt; } if (strpos($format, '%') !== false) { return strftime($format, $dt->format('U')); } return $dt->format($format); }
[ "public", "function", "getLastRun", "(", "$", "format", "=", "null", ")", "{", "if", "(", "$", "this", "->", "last_run", "===", "null", ")", "{", "return", "null", ";", "}", "if", "(", "$", "this", "->", "last_run", "===", "'0000-00-00 00:00:00'", ")", "{", "// while technically this is not a default value of null,", "// this seems to be closest in meaning.", "return", "null", ";", "}", "try", "{", "$", "dt", "=", "new", "DateTime", "(", "$", "this", "->", "last_run", ")", ";", "}", "catch", "(", "Exception", "$", "x", ")", "{", "throw", "new", "PropelException", "(", "\"Internally stored date/time/timestamp value could not be converted to DateTime: \"", ".", "var_export", "(", "$", "this", "->", "last_run", ",", "true", ")", ",", "$", "x", ")", ";", "}", "if", "(", "$", "format", "===", "null", ")", "{", "// Because propel.useDateTimeClass is true, we return a DateTime object.", "return", "$", "dt", ";", "}", "if", "(", "strpos", "(", "$", "format", ",", "'%'", ")", "!==", "false", ")", "{", "return", "strftime", "(", "$", "format", ",", "$", "dt", "->", "format", "(", "'U'", ")", ")", ";", "}", "return", "$", "dt", "->", "format", "(", "$", "format", ")", ";", "}" ]
Get the [optionally formatted] temporal [last_run] column value. @param string $format The date/time format string (either date()-style or strftime()-style). If format is null, then the raw DateTime object will be returned. @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00 @throws PropelException - if unable to parse/validate the date/time value.
[ "Get", "the", "[", "optionally", "formatted", "]", "temporal", "[", "last_run", "]", "column", "value", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L482-L511
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setType
public function setType($v) { if ($v !== null) { $v = (string) $v; } if ($this->type !== $v) { $this->type = $v; $this->modifiedColumns[] = RemoteAppPeer::TYPE; } return $this; }
php
public function setType($v) { if ($v !== null) { $v = (string) $v; } if ($this->type !== $v) { $this->type = $v; $this->modifiedColumns[] = RemoteAppPeer::TYPE; } return $this; }
[ "public", "function", "setType", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "type", "!==", "$", "v", ")", "{", "$", "this", "->", "type", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "TYPE", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [type] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "type", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L617-L630
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setDomain
public function setDomain($v) { if ($v !== null) { $v = (string) $v; } if ($this->domain !== $v) { $this->domain = $v; $this->modifiedColumns[] = RemoteAppPeer::DOMAIN; } return $this; }
php
public function setDomain($v) { if ($v !== null) { $v = (string) $v; } if ($this->domain !== $v) { $this->domain = $v; $this->modifiedColumns[] = RemoteAppPeer::DOMAIN; } return $this; }
[ "public", "function", "setDomain", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "domain", "!==", "$", "v", ")", "{", "$", "this", "->", "domain", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "DOMAIN", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [domain] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "domain", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L659-L672
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setApiUrl
public function setApiUrl($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_url !== $v) { $this->api_url = $v; $this->modifiedColumns[] = RemoteAppPeer::API_URL; } return $this; }
php
public function setApiUrl($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_url !== $v) { $this->api_url = $v; $this->modifiedColumns[] = RemoteAppPeer::API_URL; } return $this; }
[ "public", "function", "setApiUrl", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "api_url", "!==", "$", "v", ")", "{", "$", "this", "->", "api_url", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "API_URL", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [api_url] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "api_url", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L680-L693
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setApiAuthHttpUser
public function setApiAuthHttpUser($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_auth_http_user !== $v) { $this->api_auth_http_user = $v; $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_HTTP_USER; } return $this; }
php
public function setApiAuthHttpUser($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_auth_http_user !== $v) { $this->api_auth_http_user = $v; $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_HTTP_USER; } return $this; }
[ "public", "function", "setApiAuthHttpUser", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "api_auth_http_user", "!==", "$", "v", ")", "{", "$", "this", "->", "api_auth_http_user", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "API_AUTH_HTTP_USER", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [api_auth_http_user] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "api_auth_http_user", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L701-L714
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setApiAuthHttpPassword
public function setApiAuthHttpPassword($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_auth_http_password !== $v) { $this->api_auth_http_password = $v; $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_HTTP_PASSWORD; } return $this; }
php
public function setApiAuthHttpPassword($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_auth_http_password !== $v) { $this->api_auth_http_password = $v; $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_HTTP_PASSWORD; } return $this; }
[ "public", "function", "setApiAuthHttpPassword", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "api_auth_http_password", "!==", "$", "v", ")", "{", "$", "this", "->", "api_auth_http_password", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "API_AUTH_HTTP_PASSWORD", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [api_auth_http_password] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "api_auth_http_password", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L722-L735
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setApiAuthType
public function setApiAuthType($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_auth_type !== $v) { $this->api_auth_type = $v; $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_TYPE; } return $this; }
php
public function setApiAuthType($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_auth_type !== $v) { $this->api_auth_type = $v; $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_TYPE; } return $this; }
[ "public", "function", "setApiAuthType", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "api_auth_type", "!==", "$", "v", ")", "{", "$", "this", "->", "api_auth_type", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "API_AUTH_TYPE", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [api_auth_type] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "api_auth_type", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L743-L756
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setApiAuthUser
public function setApiAuthUser($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_auth_user !== $v) { $this->api_auth_user = $v; $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_USER; } return $this; }
php
public function setApiAuthUser($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_auth_user !== $v) { $this->api_auth_user = $v; $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_USER; } return $this; }
[ "public", "function", "setApiAuthUser", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "api_auth_user", "!==", "$", "v", ")", "{", "$", "this", "->", "api_auth_user", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "API_AUTH_USER", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [api_auth_user] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "api_auth_user", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L764-L777
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setApiAuthPassword
public function setApiAuthPassword($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_auth_password !== $v) { $this->api_auth_password = $v; $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_PASSWORD; } return $this; }
php
public function setApiAuthPassword($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_auth_password !== $v) { $this->api_auth_password = $v; $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_PASSWORD; } return $this; }
[ "public", "function", "setApiAuthPassword", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "api_auth_password", "!==", "$", "v", ")", "{", "$", "this", "->", "api_auth_password", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "API_AUTH_PASSWORD", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [api_auth_password] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "api_auth_password", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L785-L798
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setApiAuthToken
public function setApiAuthToken($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_auth_token !== $v) { $this->api_auth_token = $v; $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_TOKEN; } return $this; }
php
public function setApiAuthToken($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_auth_token !== $v) { $this->api_auth_token = $v; $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_TOKEN; } return $this; }
[ "public", "function", "setApiAuthToken", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "api_auth_token", "!==", "$", "v", ")", "{", "$", "this", "->", "api_auth_token", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "API_AUTH_TOKEN", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [api_auth_token] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "api_auth_token", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L806-L819
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setApiAuthUrlUserKey
public function setApiAuthUrlUserKey($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_auth_url_user_key !== $v) { $this->api_auth_url_user_key = $v; $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_URL_USER_KEY; } return $this; }
php
public function setApiAuthUrlUserKey($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_auth_url_user_key !== $v) { $this->api_auth_url_user_key = $v; $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_URL_USER_KEY; } return $this; }
[ "public", "function", "setApiAuthUrlUserKey", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "api_auth_url_user_key", "!==", "$", "v", ")", "{", "$", "this", "->", "api_auth_url_user_key", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "API_AUTH_URL_USER_KEY", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [api_auth_url_user_key] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "api_auth_url_user_key", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L827-L840
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setApiAuthUrlPwKey
public function setApiAuthUrlPwKey($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_auth_url_pw_key !== $v) { $this->api_auth_url_pw_key = $v; $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_URL_PW_KEY; } return $this; }
php
public function setApiAuthUrlPwKey($v) { if ($v !== null) { $v = (string) $v; } if ($this->api_auth_url_pw_key !== $v) { $this->api_auth_url_pw_key = $v; $this->modifiedColumns[] = RemoteAppPeer::API_AUTH_URL_PW_KEY; } return $this; }
[ "public", "function", "setApiAuthUrlPwKey", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "api_auth_url_pw_key", "!==", "$", "v", ")", "{", "$", "this", "->", "api_auth_url_pw_key", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "API_AUTH_URL_PW_KEY", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [api_auth_url_pw_key] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "api_auth_url_pw_key", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L848-L861
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setCron
public function setCron($v) { if ($v !== null) { $v = (string) $v; } if ($this->cron !== $v) { $this->cron = $v; $this->modifiedColumns[] = RemoteAppPeer::CRON; } return $this; }
php
public function setCron($v) { if ($v !== null) { $v = (string) $v; } if ($this->cron !== $v) { $this->cron = $v; $this->modifiedColumns[] = RemoteAppPeer::CRON; } return $this; }
[ "public", "function", "setCron", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "cron", "!==", "$", "v", ")", "{", "$", "this", "->", "cron", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "CRON", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [cron] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "cron", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L869-L882
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setCustomerId
public function setCustomerId($v) { if ($v !== null && is_numeric($v)) { $v = (int) $v; } if ($this->customer_id !== $v) { $this->customer_id = $v; $this->modifiedColumns[] = RemoteAppPeer::CUSTOMER_ID; } if ($this->aCustomer !== null && $this->aCustomer->getId() !== $v) { $this->aCustomer = null; } return $this; }
php
public function setCustomerId($v) { if ($v !== null && is_numeric($v)) { $v = (int) $v; } if ($this->customer_id !== $v) { $this->customer_id = $v; $this->modifiedColumns[] = RemoteAppPeer::CUSTOMER_ID; } if ($this->aCustomer !== null && $this->aCustomer->getId() !== $v) { $this->aCustomer = null; } return $this; }
[ "public", "function", "setCustomerId", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", "&&", "is_numeric", "(", "$", "v", ")", ")", "{", "$", "v", "=", "(", "int", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "customer_id", "!==", "$", "v", ")", "{", "$", "this", "->", "customer_id", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "CUSTOMER_ID", ";", "}", "if", "(", "$", "this", "->", "aCustomer", "!==", "null", "&&", "$", "this", "->", "aCustomer", "->", "getId", "(", ")", "!==", "$", "v", ")", "{", "$", "this", "->", "aCustomer", "=", "null", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [customer_id] column. @param int $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "customer_id", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L890-L907
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setActivated
public function setActivated($v) { if ($v !== null) { if (is_string($v)) { $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; } else { $v = (boolean) $v; } } if ($this->activated !== $v) { $this->activated = $v; $this->modifiedColumns[] = RemoteAppPeer::ACTIVATED; } return $this; }
php
public function setActivated($v) { if ($v !== null) { if (is_string($v)) { $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; } else { $v = (boolean) $v; } } if ($this->activated !== $v) { $this->activated = $v; $this->modifiedColumns[] = RemoteAppPeer::ACTIVATED; } return $this; }
[ "public", "function", "setActivated", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "if", "(", "is_string", "(", "$", "v", ")", ")", "{", "$", "v", "=", "in_array", "(", "strtolower", "(", "$", "v", ")", ",", "array", "(", "'false'", ",", "'off'", ",", "'-'", ",", "'no'", ",", "'n'", ",", "'0'", ",", "''", ")", ")", "?", "false", ":", "true", ";", "}", "else", "{", "$", "v", "=", "(", "boolean", ")", "$", "v", ";", "}", "}", "if", "(", "$", "this", "->", "activated", "!==", "$", "v", ")", "{", "$", "this", "->", "activated", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "ACTIVATED", ";", "}", "return", "$", "this", ";", "}" ]
Sets the value of the [activated] column. Non-boolean arguments are converted using the following rules: * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * 0, '0', 'false', 'off', and 'no' are converted to boolean false Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). @param boolean|integer|string $v The new value @return RemoteApp The current object (for fluent API support)
[ "Sets", "the", "value", "of", "the", "[", "activated", "]", "column", ".", "Non", "-", "boolean", "arguments", "are", "converted", "using", "the", "following", "rules", ":", "*", "1", "1", "true", "on", "and", "yes", "are", "converted", "to", "boolean", "true", "*", "0", "0", "false", "off", "and", "no", "are", "converted", "to", "boolean", "false", "Check", "on", "string", "values", "is", "case", "insensitive", "(", "so", "FaLsE", "is", "seen", "as", "false", ")", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L919-L936
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setNotes
public function setNotes($v) { if ($v !== null) { $v = (string) $v; } if ($this->notes !== $v) { $this->notes = $v; $this->modifiedColumns[] = RemoteAppPeer::NOTES; } return $this; }
php
public function setNotes($v) { if ($v !== null) { $v = (string) $v; } if ($this->notes !== $v) { $this->notes = $v; $this->modifiedColumns[] = RemoteAppPeer::NOTES; } return $this; }
[ "public", "function", "setNotes", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "notes", "!==", "$", "v", ")", "{", "$", "this", "->", "notes", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "NOTES", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [notes] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "notes", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L944-L957
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setLastRun
public function setLastRun($v) { $dt = PropelDateTime::newInstance($v, null, 'DateTime'); if ($this->last_run !== null || $dt !== null) { $currentDateAsString = ($this->last_run !== null && $tmpDt = new DateTime($this->last_run)) ? $tmpDt->format('Y-m-d H:i:s') : null; $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; if ($currentDateAsString !== $newDateAsString) { $this->last_run = $newDateAsString; $this->modifiedColumns[] = RemoteAppPeer::LAST_RUN; } } // if either are not null return $this; }
php
public function setLastRun($v) { $dt = PropelDateTime::newInstance($v, null, 'DateTime'); if ($this->last_run !== null || $dt !== null) { $currentDateAsString = ($this->last_run !== null && $tmpDt = new DateTime($this->last_run)) ? $tmpDt->format('Y-m-d H:i:s') : null; $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null; if ($currentDateAsString !== $newDateAsString) { $this->last_run = $newDateAsString; $this->modifiedColumns[] = RemoteAppPeer::LAST_RUN; } } // if either are not null return $this; }
[ "public", "function", "setLastRun", "(", "$", "v", ")", "{", "$", "dt", "=", "PropelDateTime", "::", "newInstance", "(", "$", "v", ",", "null", ",", "'DateTime'", ")", ";", "if", "(", "$", "this", "->", "last_run", "!==", "null", "||", "$", "dt", "!==", "null", ")", "{", "$", "currentDateAsString", "=", "(", "$", "this", "->", "last_run", "!==", "null", "&&", "$", "tmpDt", "=", "new", "DateTime", "(", "$", "this", "->", "last_run", ")", ")", "?", "$", "tmpDt", "->", "format", "(", "'Y-m-d H:i:s'", ")", ":", "null", ";", "$", "newDateAsString", "=", "$", "dt", "?", "$", "dt", "->", "format", "(", "'Y-m-d H:i:s'", ")", ":", "null", ";", "if", "(", "$", "currentDateAsString", "!==", "$", "newDateAsString", ")", "{", "$", "this", "->", "last_run", "=", "$", "newDateAsString", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "LAST_RUN", ";", "}", "}", "// if either are not null", "return", "$", "this", ";", "}" ]
Sets the value of [last_run] column to a normalized version of the date/time value specified. @param mixed $v string, integer (timestamp), or DateTime value. Empty strings are treated as null. @return RemoteApp The current object (for fluent API support)
[ "Sets", "the", "value", "of", "[", "last_run", "]", "column", "to", "a", "normalized", "version", "of", "the", "date", "/", "time", "value", "specified", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L966-L980
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setIncludelog
public function setIncludelog($v) { if ($v !== null) { if (is_string($v)) { $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; } else { $v = (boolean) $v; } } if ($this->includelog !== $v) { $this->includelog = $v; $this->modifiedColumns[] = RemoteAppPeer::INCLUDELOG; } return $this; }
php
public function setIncludelog($v) { if ($v !== null) { if (is_string($v)) { $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; } else { $v = (boolean) $v; } } if ($this->includelog !== $v) { $this->includelog = $v; $this->modifiedColumns[] = RemoteAppPeer::INCLUDELOG; } return $this; }
[ "public", "function", "setIncludelog", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "if", "(", "is_string", "(", "$", "v", ")", ")", "{", "$", "v", "=", "in_array", "(", "strtolower", "(", "$", "v", ")", ",", "array", "(", "'false'", ",", "'off'", ",", "'-'", ",", "'no'", ",", "'n'", ",", "'0'", ",", "''", ")", ")", "?", "false", ":", "true", ";", "}", "else", "{", "$", "v", "=", "(", "boolean", ")", "$", "v", ";", "}", "}", "if", "(", "$", "this", "->", "includelog", "!==", "$", "v", ")", "{", "$", "this", "->", "includelog", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "INCLUDELOG", ";", "}", "return", "$", "this", ";", "}" ]
Sets the value of the [includelog] column. Non-boolean arguments are converted using the following rules: * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * 0, '0', 'false', 'off', and 'no' are converted to boolean false Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). @param boolean|integer|string $v The new value @return RemoteApp The current object (for fluent API support)
[ "Sets", "the", "value", "of", "the", "[", "includelog", "]", "column", ".", "Non", "-", "boolean", "arguments", "are", "converted", "using", "the", "following", "rules", ":", "*", "1", "1", "true", "on", "and", "yes", "are", "converted", "to", "boolean", "true", "*", "0", "0", "false", "off", "and", "no", "are", "converted", "to", "boolean", "false", "Check", "on", "string", "values", "is", "case", "insensitive", "(", "so", "FaLsE", "is", "seen", "as", "false", ")", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L992-L1009
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setPublicKey
public function setPublicKey($v) { if ($v !== null) { $v = (string) $v; } if ($this->public_key !== $v) { $this->public_key = $v; $this->modifiedColumns[] = RemoteAppPeer::PUBLIC_KEY; } return $this; }
php
public function setPublicKey($v) { if ($v !== null) { $v = (string) $v; } if ($this->public_key !== $v) { $this->public_key = $v; $this->modifiedColumns[] = RemoteAppPeer::PUBLIC_KEY; } return $this; }
[ "public", "function", "setPublicKey", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "public_key", "!==", "$", "v", ")", "{", "$", "this", "->", "public_key", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "PUBLIC_KEY", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [public_key] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "public_key", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L1017-L1030
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setWebsiteHash
public function setWebsiteHash($v) { if ($v !== null) { $v = (string) $v; } if ($this->website_hash !== $v) { $this->website_hash = $v; $this->modifiedColumns[] = RemoteAppPeer::WEBSITE_HASH; } return $this; }
php
public function setWebsiteHash($v) { if ($v !== null) { $v = (string) $v; } if ($this->website_hash !== $v) { $this->website_hash = $v; $this->modifiedColumns[] = RemoteAppPeer::WEBSITE_HASH; } return $this; }
[ "public", "function", "setWebsiteHash", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "website_hash", "!==", "$", "v", ")", "{", "$", "this", "->", "website_hash", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "WEBSITE_HASH", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [website_hash] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "website_hash", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L1038-L1051
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setNotificationRecipient
public function setNotificationRecipient($v) { if ($v !== null) { $v = (string) $v; } if ($this->notification_recipient !== $v) { $this->notification_recipient = $v; $this->modifiedColumns[] = RemoteAppPeer::NOTIFICATION_RECIPIENT; } return $this; }
php
public function setNotificationRecipient($v) { if ($v !== null) { $v = (string) $v; } if ($this->notification_recipient !== $v) { $this->notification_recipient = $v; $this->modifiedColumns[] = RemoteAppPeer::NOTIFICATION_RECIPIENT; } return $this; }
[ "public", "function", "setNotificationRecipient", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "notification_recipient", "!==", "$", "v", ")", "{", "$", "this", "->", "notification_recipient", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "NOTIFICATION_RECIPIENT", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [notification_recipient] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "notification_recipient", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L1059-L1072
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setNotificationSender
public function setNotificationSender($v) { if ($v !== null) { $v = (string) $v; } if ($this->notification_sender !== $v) { $this->notification_sender = $v; $this->modifiedColumns[] = RemoteAppPeer::NOTIFICATION_SENDER; } return $this; }
php
public function setNotificationSender($v) { if ($v !== null) { $v = (string) $v; } if ($this->notification_sender !== $v) { $this->notification_sender = $v; $this->modifiedColumns[] = RemoteAppPeer::NOTIFICATION_SENDER; } return $this; }
[ "public", "function", "setNotificationSender", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "$", "v", "=", "(", "string", ")", "$", "v", ";", "}", "if", "(", "$", "this", "->", "notification_sender", "!==", "$", "v", ")", "{", "$", "this", "->", "notification_sender", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "NOTIFICATION_SENDER", ";", "}", "return", "$", "this", ";", "}" ]
Set the value of [notification_sender] column. @param string $v new value @return RemoteApp The current object (for fluent API support)
[ "Set", "the", "value", "of", "[", "notification_sender", "]", "column", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L1080-L1093
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setNotificationChange
public function setNotificationChange($v) { if ($v !== null) { if (is_string($v)) { $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; } else { $v = (boolean) $v; } } if ($this->notification_change !== $v) { $this->notification_change = $v; $this->modifiedColumns[] = RemoteAppPeer::NOTIFICATION_CHANGE; } return $this; }
php
public function setNotificationChange($v) { if ($v !== null) { if (is_string($v)) { $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; } else { $v = (boolean) $v; } } if ($this->notification_change !== $v) { $this->notification_change = $v; $this->modifiedColumns[] = RemoteAppPeer::NOTIFICATION_CHANGE; } return $this; }
[ "public", "function", "setNotificationChange", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "if", "(", "is_string", "(", "$", "v", ")", ")", "{", "$", "v", "=", "in_array", "(", "strtolower", "(", "$", "v", ")", ",", "array", "(", "'false'", ",", "'off'", ",", "'-'", ",", "'no'", ",", "'n'", ",", "'0'", ",", "''", ")", ")", "?", "false", ":", "true", ";", "}", "else", "{", "$", "v", "=", "(", "boolean", ")", "$", "v", ";", "}", "}", "if", "(", "$", "this", "->", "notification_change", "!==", "$", "v", ")", "{", "$", "this", "->", "notification_change", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "NOTIFICATION_CHANGE", ";", "}", "return", "$", "this", ";", "}" ]
Sets the value of the [notification_change] column. Non-boolean arguments are converted using the following rules: * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * 0, '0', 'false', 'off', and 'no' are converted to boolean false Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). @param boolean|integer|string $v The new value @return RemoteApp The current object (for fluent API support)
[ "Sets", "the", "value", "of", "the", "[", "notification_change", "]", "column", ".", "Non", "-", "boolean", "arguments", "are", "converted", "using", "the", "following", "rules", ":", "*", "1", "1", "true", "on", "and", "yes", "are", "converted", "to", "boolean", "true", "*", "0", "0", "false", "off", "and", "no", "are", "converted", "to", "boolean", "false", "Check", "on", "string", "values", "is", "case", "insensitive", "(", "so", "FaLsE", "is", "seen", "as", "false", ")", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L1105-L1122
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setNotificationError
public function setNotificationError($v) { if ($v !== null) { if (is_string($v)) { $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; } else { $v = (boolean) $v; } } if ($this->notification_error !== $v) { $this->notification_error = $v; $this->modifiedColumns[] = RemoteAppPeer::NOTIFICATION_ERROR; } return $this; }
php
public function setNotificationError($v) { if ($v !== null) { if (is_string($v)) { $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true; } else { $v = (boolean) $v; } } if ($this->notification_error !== $v) { $this->notification_error = $v; $this->modifiedColumns[] = RemoteAppPeer::NOTIFICATION_ERROR; } return $this; }
[ "public", "function", "setNotificationError", "(", "$", "v", ")", "{", "if", "(", "$", "v", "!==", "null", ")", "{", "if", "(", "is_string", "(", "$", "v", ")", ")", "{", "$", "v", "=", "in_array", "(", "strtolower", "(", "$", "v", ")", ",", "array", "(", "'false'", ",", "'off'", ",", "'-'", ",", "'no'", ",", "'n'", ",", "'0'", ",", "''", ")", ")", "?", "false", ":", "true", ";", "}", "else", "{", "$", "v", "=", "(", "boolean", ")", "$", "v", ";", "}", "}", "if", "(", "$", "this", "->", "notification_error", "!==", "$", "v", ")", "{", "$", "this", "->", "notification_error", "=", "$", "v", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "NOTIFICATION_ERROR", ";", "}", "return", "$", "this", ";", "}" ]
Sets the value of the [notification_error] column. Non-boolean arguments are converted using the following rules: * 1, '1', 'true', 'on', and 'yes' are converted to boolean true * 0, '0', 'false', 'off', and 'no' are converted to boolean false Check on string values is case insensitive (so 'FaLsE' is seen as 'false'). @param boolean|integer|string $v The new value @return RemoteApp The current object (for fluent API support)
[ "Sets", "the", "value", "of", "the", "[", "notification_error", "]", "column", ".", "Non", "-", "boolean", "arguments", "are", "converted", "using", "the", "following", "rules", ":", "*", "1", "1", "true", "on", "and", "yes", "are", "converted", "to", "boolean", "true", "*", "0", "0", "false", "off", "and", "no", "are", "converted", "to", "boolean", "false", "Check", "on", "string", "values", "is", "case", "insensitive", "(", "so", "FaLsE", "is", "seen", "as", "false", ")", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L1134-L1151
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.hasOnlyDefaultValues
public function hasOnlyDefaultValues() { if ($this->type !== 'contao') { return false; } if ($this->api_auth_type !== 'none') { return false; } if ($this->activated !== false) { return false; } if ($this->includelog !== false) { return false; } if ($this->website_hash !== '') { return false; } if ($this->notification_recipient !== '') { return false; } if ($this->notification_sender !== '') { return false; } if ($this->notification_change !== true) { return false; } if ($this->notification_error !== true) { return false; } // otherwise, everything was equal, so return true return true; }
php
public function hasOnlyDefaultValues() { if ($this->type !== 'contao') { return false; } if ($this->api_auth_type !== 'none') { return false; } if ($this->activated !== false) { return false; } if ($this->includelog !== false) { return false; } if ($this->website_hash !== '') { return false; } if ($this->notification_recipient !== '') { return false; } if ($this->notification_sender !== '') { return false; } if ($this->notification_change !== true) { return false; } if ($this->notification_error !== true) { return false; } // otherwise, everything was equal, so return true return true; }
[ "public", "function", "hasOnlyDefaultValues", "(", ")", "{", "if", "(", "$", "this", "->", "type", "!==", "'contao'", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "api_auth_type", "!==", "'none'", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "activated", "!==", "false", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "includelog", "!==", "false", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "website_hash", "!==", "''", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "notification_recipient", "!==", "''", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "notification_sender", "!==", "''", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "notification_change", "!==", "true", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "notification_error", "!==", "true", ")", "{", "return", "false", ";", "}", "// otherwise, everything was equal, so return true", "return", "true", ";", "}" ]
Indicates whether the columns in this object are only set to default values. This method can be used in conjunction with isModified() to indicate whether an object is both modified _and_ has some values set which are non-default. @return boolean Whether the columns in this object are only been set with default values.
[ "Indicates", "whether", "the", "columns", "in", "this", "object", "are", "only", "set", "to", "default", "values", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L1161-L1201
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.hydrate
public function hydrate($row, $startcol = 0, $rehydrate = false) { try { $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; $this->type = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; $this->name = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; $this->domain = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; $this->api_url = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; $this->api_auth_http_user = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; $this->api_auth_http_password = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; $this->api_auth_type = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; $this->api_auth_user = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; $this->api_auth_password = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; $this->api_auth_token = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; $this->api_auth_url_user_key = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; $this->api_auth_url_pw_key = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null; $this->cron = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null; $this->customer_id = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null; $this->activated = ($row[$startcol + 15] !== null) ? (boolean) $row[$startcol + 15] : null; $this->notes = ($row[$startcol + 16] !== null) ? (string) $row[$startcol + 16] : null; $this->last_run = ($row[$startcol + 17] !== null) ? (string) $row[$startcol + 17] : null; $this->includelog = ($row[$startcol + 18] !== null) ? (boolean) $row[$startcol + 18] : null; $this->public_key = ($row[$startcol + 19] !== null) ? (string) $row[$startcol + 19] : null; $this->website_hash = ($row[$startcol + 20] !== null) ? (string) $row[$startcol + 20] : null; $this->notification_recipient = ($row[$startcol + 21] !== null) ? (string) $row[$startcol + 21] : null; $this->notification_sender = ($row[$startcol + 22] !== null) ? (string) $row[$startcol + 22] : null; $this->notification_change = ($row[$startcol + 23] !== null) ? (boolean) $row[$startcol + 23] : null; $this->notification_error = ($row[$startcol + 24] !== null) ? (boolean) $row[$startcol + 24] : null; $this->resetModified(); $this->setNew(false); if ($rehydrate) { $this->ensureConsistency(); } $this->postHydrate($row, $startcol, $rehydrate); return $startcol + 25; // 25 = RemoteAppPeer::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating RemoteApp object", $e); } }
php
public function hydrate($row, $startcol = 0, $rehydrate = false) { try { $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; $this->type = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; $this->name = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; $this->domain = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; $this->api_url = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; $this->api_auth_http_user = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; $this->api_auth_http_password = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; $this->api_auth_type = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; $this->api_auth_user = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; $this->api_auth_password = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; $this->api_auth_token = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; $this->api_auth_url_user_key = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; $this->api_auth_url_pw_key = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null; $this->cron = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null; $this->customer_id = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null; $this->activated = ($row[$startcol + 15] !== null) ? (boolean) $row[$startcol + 15] : null; $this->notes = ($row[$startcol + 16] !== null) ? (string) $row[$startcol + 16] : null; $this->last_run = ($row[$startcol + 17] !== null) ? (string) $row[$startcol + 17] : null; $this->includelog = ($row[$startcol + 18] !== null) ? (boolean) $row[$startcol + 18] : null; $this->public_key = ($row[$startcol + 19] !== null) ? (string) $row[$startcol + 19] : null; $this->website_hash = ($row[$startcol + 20] !== null) ? (string) $row[$startcol + 20] : null; $this->notification_recipient = ($row[$startcol + 21] !== null) ? (string) $row[$startcol + 21] : null; $this->notification_sender = ($row[$startcol + 22] !== null) ? (string) $row[$startcol + 22] : null; $this->notification_change = ($row[$startcol + 23] !== null) ? (boolean) $row[$startcol + 23] : null; $this->notification_error = ($row[$startcol + 24] !== null) ? (boolean) $row[$startcol + 24] : null; $this->resetModified(); $this->setNew(false); if ($rehydrate) { $this->ensureConsistency(); } $this->postHydrate($row, $startcol, $rehydrate); return $startcol + 25; // 25 = RemoteAppPeer::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating RemoteApp object", $e); } }
[ "public", "function", "hydrate", "(", "$", "row", ",", "$", "startcol", "=", "0", ",", "$", "rehydrate", "=", "false", ")", "{", "try", "{", "$", "this", "->", "id", "=", "(", "$", "row", "[", "$", "startcol", "+", "0", "]", "!==", "null", ")", "?", "(", "int", ")", "$", "row", "[", "$", "startcol", "+", "0", "]", ":", "null", ";", "$", "this", "->", "type", "=", "(", "$", "row", "[", "$", "startcol", "+", "1", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "1", "]", ":", "null", ";", "$", "this", "->", "name", "=", "(", "$", "row", "[", "$", "startcol", "+", "2", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "2", "]", ":", "null", ";", "$", "this", "->", "domain", "=", "(", "$", "row", "[", "$", "startcol", "+", "3", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "3", "]", ":", "null", ";", "$", "this", "->", "api_url", "=", "(", "$", "row", "[", "$", "startcol", "+", "4", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "4", "]", ":", "null", ";", "$", "this", "->", "api_auth_http_user", "=", "(", "$", "row", "[", "$", "startcol", "+", "5", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "5", "]", ":", "null", ";", "$", "this", "->", "api_auth_http_password", "=", "(", "$", "row", "[", "$", "startcol", "+", "6", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "6", "]", ":", "null", ";", "$", "this", "->", "api_auth_type", "=", "(", "$", "row", "[", "$", "startcol", "+", "7", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "7", "]", ":", "null", ";", "$", "this", "->", "api_auth_user", "=", "(", "$", "row", "[", "$", "startcol", "+", "8", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "8", "]", ":", "null", ";", "$", "this", "->", "api_auth_password", "=", "(", "$", "row", "[", "$", "startcol", "+", "9", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "9", "]", ":", "null", ";", "$", "this", "->", "api_auth_token", "=", "(", "$", "row", "[", "$", "startcol", "+", "10", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "10", "]", ":", "null", ";", "$", "this", "->", "api_auth_url_user_key", "=", "(", "$", "row", "[", "$", "startcol", "+", "11", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "11", "]", ":", "null", ";", "$", "this", "->", "api_auth_url_pw_key", "=", "(", "$", "row", "[", "$", "startcol", "+", "12", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "12", "]", ":", "null", ";", "$", "this", "->", "cron", "=", "(", "$", "row", "[", "$", "startcol", "+", "13", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "13", "]", ":", "null", ";", "$", "this", "->", "customer_id", "=", "(", "$", "row", "[", "$", "startcol", "+", "14", "]", "!==", "null", ")", "?", "(", "int", ")", "$", "row", "[", "$", "startcol", "+", "14", "]", ":", "null", ";", "$", "this", "->", "activated", "=", "(", "$", "row", "[", "$", "startcol", "+", "15", "]", "!==", "null", ")", "?", "(", "boolean", ")", "$", "row", "[", "$", "startcol", "+", "15", "]", ":", "null", ";", "$", "this", "->", "notes", "=", "(", "$", "row", "[", "$", "startcol", "+", "16", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "16", "]", ":", "null", ";", "$", "this", "->", "last_run", "=", "(", "$", "row", "[", "$", "startcol", "+", "17", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "17", "]", ":", "null", ";", "$", "this", "->", "includelog", "=", "(", "$", "row", "[", "$", "startcol", "+", "18", "]", "!==", "null", ")", "?", "(", "boolean", ")", "$", "row", "[", "$", "startcol", "+", "18", "]", ":", "null", ";", "$", "this", "->", "public_key", "=", "(", "$", "row", "[", "$", "startcol", "+", "19", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "19", "]", ":", "null", ";", "$", "this", "->", "website_hash", "=", "(", "$", "row", "[", "$", "startcol", "+", "20", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "20", "]", ":", "null", ";", "$", "this", "->", "notification_recipient", "=", "(", "$", "row", "[", "$", "startcol", "+", "21", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "21", "]", ":", "null", ";", "$", "this", "->", "notification_sender", "=", "(", "$", "row", "[", "$", "startcol", "+", "22", "]", "!==", "null", ")", "?", "(", "string", ")", "$", "row", "[", "$", "startcol", "+", "22", "]", ":", "null", ";", "$", "this", "->", "notification_change", "=", "(", "$", "row", "[", "$", "startcol", "+", "23", "]", "!==", "null", ")", "?", "(", "boolean", ")", "$", "row", "[", "$", "startcol", "+", "23", "]", ":", "null", ";", "$", "this", "->", "notification_error", "=", "(", "$", "row", "[", "$", "startcol", "+", "24", "]", "!==", "null", ")", "?", "(", "boolean", ")", "$", "row", "[", "$", "startcol", "+", "24", "]", ":", "null", ";", "$", "this", "->", "resetModified", "(", ")", ";", "$", "this", "->", "setNew", "(", "false", ")", ";", "if", "(", "$", "rehydrate", ")", "{", "$", "this", "->", "ensureConsistency", "(", ")", ";", "}", "$", "this", "->", "postHydrate", "(", "$", "row", ",", "$", "startcol", ",", "$", "rehydrate", ")", ";", "return", "$", "startcol", "+", "25", ";", "// 25 = RemoteAppPeer::NUM_HYDRATE_COLUMNS.", "}", "catch", "(", "Exception", "$", "e", ")", "{", "throw", "new", "PropelException", "(", "\"Error populating RemoteApp object\"", ",", "$", "e", ")", ";", "}", "}" ]
Hydrates (populates) the object variables with values from the database resultset. An offset (0-based "start column") is specified so that objects can be hydrated with a subset of the columns in the resultset rows. This is needed, for example, for results of JOIN queries where the resultset row includes columns from two or more tables. @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM) @param int $startcol 0-based offset column which indicates which resultset column to start with. @param boolean $rehydrate Whether this object is being re-hydrated from the database. @return int next starting column @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
[ "Hydrates", "(", "populates", ")", "the", "object", "variables", "with", "values", "from", "the", "database", "resultset", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L1217-L1260
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.ensureConsistency
public function ensureConsistency() { if ($this->aCustomer !== null && $this->customer_id !== $this->aCustomer->getId()) { $this->aCustomer = null; } }
php
public function ensureConsistency() { if ($this->aCustomer !== null && $this->customer_id !== $this->aCustomer->getId()) { $this->aCustomer = null; } }
[ "public", "function", "ensureConsistency", "(", ")", "{", "if", "(", "$", "this", "->", "aCustomer", "!==", "null", "&&", "$", "this", "->", "customer_id", "!==", "$", "this", "->", "aCustomer", "->", "getId", "(", ")", ")", "{", "$", "this", "->", "aCustomer", "=", "null", ";", "}", "}" ]
Checks and repairs the internal consistency of the object. This method is executed after an already-instantiated object is re-hydrated from the database. It exists to check any foreign keys to make sure that the objects related to the current object are correct based on foreign key. You can override this method in the stub class, but you should always invoke the base method from the overridden method (i.e. parent::ensureConsistency()), in case your model changes. @throws PropelException
[ "Checks", "and", "repairs", "the", "internal", "consistency", "of", "the", "object", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L1275-L1281
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.doSave
protected function doSave(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; // We call the save method on the following object(s) if they // were passed to this object by their corresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aCustomer !== null) { if ($this->aCustomer->isModified() || $this->aCustomer->isNew()) { $affectedRows += $this->aCustomer->save($con); } $this->setCustomer($this->aCustomer); } if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); } else { $this->doUpdate($con); } $affectedRows += 1; $this->resetModified(); } if ($this->apiLogsScheduledForDeletion !== null) { if (!$this->apiLogsScheduledForDeletion->isEmpty()) { ApiLogQuery::create() ->filterByPrimaryKeys($this->apiLogsScheduledForDeletion->getPrimaryKeys(false)) ->delete($con); $this->apiLogsScheduledForDeletion = null; } } if ($this->collApiLogs !== null) { foreach ($this->collApiLogs as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->remoteHistoryContaosScheduledForDeletion !== null) { if (!$this->remoteHistoryContaosScheduledForDeletion->isEmpty()) { RemoteHistoryContaoQuery::create() ->filterByPrimaryKeys($this->remoteHistoryContaosScheduledForDeletion->getPrimaryKeys(false)) ->delete($con); $this->remoteHistoryContaosScheduledForDeletion = null; } } if ($this->collRemoteHistoryContaos !== null) { foreach ($this->collRemoteHistoryContaos as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }
php
protected function doSave(PropelPDO $con) { $affectedRows = 0; // initialize var to track total num of affected rows if (!$this->alreadyInSave) { $this->alreadyInSave = true; // We call the save method on the following object(s) if they // were passed to this object by their corresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aCustomer !== null) { if ($this->aCustomer->isModified() || $this->aCustomer->isNew()) { $affectedRows += $this->aCustomer->save($con); } $this->setCustomer($this->aCustomer); } if ($this->isNew() || $this->isModified()) { // persist changes if ($this->isNew()) { $this->doInsert($con); } else { $this->doUpdate($con); } $affectedRows += 1; $this->resetModified(); } if ($this->apiLogsScheduledForDeletion !== null) { if (!$this->apiLogsScheduledForDeletion->isEmpty()) { ApiLogQuery::create() ->filterByPrimaryKeys($this->apiLogsScheduledForDeletion->getPrimaryKeys(false)) ->delete($con); $this->apiLogsScheduledForDeletion = null; } } if ($this->collApiLogs !== null) { foreach ($this->collApiLogs as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } if ($this->remoteHistoryContaosScheduledForDeletion !== null) { if (!$this->remoteHistoryContaosScheduledForDeletion->isEmpty()) { RemoteHistoryContaoQuery::create() ->filterByPrimaryKeys($this->remoteHistoryContaosScheduledForDeletion->getPrimaryKeys(false)) ->delete($con); $this->remoteHistoryContaosScheduledForDeletion = null; } } if ($this->collRemoteHistoryContaos !== null) { foreach ($this->collRemoteHistoryContaos as $referrerFK) { if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { $affectedRows += $referrerFK->save($con); } } } $this->alreadyInSave = false; } return $affectedRows; }
[ "protected", "function", "doSave", "(", "PropelPDO", "$", "con", ")", "{", "$", "affectedRows", "=", "0", ";", "// initialize var to track total num of affected rows", "if", "(", "!", "$", "this", "->", "alreadyInSave", ")", "{", "$", "this", "->", "alreadyInSave", "=", "true", ";", "// We call the save method on the following object(s) if they", "// were passed to this object by their corresponding set", "// method. This object relates to these object(s) by a", "// foreign key reference.", "if", "(", "$", "this", "->", "aCustomer", "!==", "null", ")", "{", "if", "(", "$", "this", "->", "aCustomer", "->", "isModified", "(", ")", "||", "$", "this", "->", "aCustomer", "->", "isNew", "(", ")", ")", "{", "$", "affectedRows", "+=", "$", "this", "->", "aCustomer", "->", "save", "(", "$", "con", ")", ";", "}", "$", "this", "->", "setCustomer", "(", "$", "this", "->", "aCustomer", ")", ";", "}", "if", "(", "$", "this", "->", "isNew", "(", ")", "||", "$", "this", "->", "isModified", "(", ")", ")", "{", "// persist changes", "if", "(", "$", "this", "->", "isNew", "(", ")", ")", "{", "$", "this", "->", "doInsert", "(", "$", "con", ")", ";", "}", "else", "{", "$", "this", "->", "doUpdate", "(", "$", "con", ")", ";", "}", "$", "affectedRows", "+=", "1", ";", "$", "this", "->", "resetModified", "(", ")", ";", "}", "if", "(", "$", "this", "->", "apiLogsScheduledForDeletion", "!==", "null", ")", "{", "if", "(", "!", "$", "this", "->", "apiLogsScheduledForDeletion", "->", "isEmpty", "(", ")", ")", "{", "ApiLogQuery", "::", "create", "(", ")", "->", "filterByPrimaryKeys", "(", "$", "this", "->", "apiLogsScheduledForDeletion", "->", "getPrimaryKeys", "(", "false", ")", ")", "->", "delete", "(", "$", "con", ")", ";", "$", "this", "->", "apiLogsScheduledForDeletion", "=", "null", ";", "}", "}", "if", "(", "$", "this", "->", "collApiLogs", "!==", "null", ")", "{", "foreach", "(", "$", "this", "->", "collApiLogs", "as", "$", "referrerFK", ")", "{", "if", "(", "!", "$", "referrerFK", "->", "isDeleted", "(", ")", "&&", "(", "$", "referrerFK", "->", "isNew", "(", ")", "||", "$", "referrerFK", "->", "isModified", "(", ")", ")", ")", "{", "$", "affectedRows", "+=", "$", "referrerFK", "->", "save", "(", "$", "con", ")", ";", "}", "}", "}", "if", "(", "$", "this", "->", "remoteHistoryContaosScheduledForDeletion", "!==", "null", ")", "{", "if", "(", "!", "$", "this", "->", "remoteHistoryContaosScheduledForDeletion", "->", "isEmpty", "(", ")", ")", "{", "RemoteHistoryContaoQuery", "::", "create", "(", ")", "->", "filterByPrimaryKeys", "(", "$", "this", "->", "remoteHistoryContaosScheduledForDeletion", "->", "getPrimaryKeys", "(", "false", ")", ")", "->", "delete", "(", "$", "con", ")", ";", "$", "this", "->", "remoteHistoryContaosScheduledForDeletion", "=", "null", ";", "}", "}", "if", "(", "$", "this", "->", "collRemoteHistoryContaos", "!==", "null", ")", "{", "foreach", "(", "$", "this", "->", "collRemoteHistoryContaos", "as", "$", "referrerFK", ")", "{", "if", "(", "!", "$", "referrerFK", "->", "isDeleted", "(", ")", "&&", "(", "$", "referrerFK", "->", "isNew", "(", ")", "||", "$", "referrerFK", "->", "isModified", "(", ")", ")", ")", "{", "$", "affectedRows", "+=", "$", "referrerFK", "->", "save", "(", "$", "con", ")", ";", "}", "}", "}", "$", "this", "->", "alreadyInSave", "=", "false", ";", "}", "return", "$", "affectedRows", ";", "}" ]
Performs the work of inserting or updating the row in the database. If the object is new, it inserts it; otherwise an update is performed. All related objects are also updated in this method. @param PropelPDO $con @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. @throws PropelException @see save()
[ "Performs", "the", "work", "of", "inserting", "or", "updating", "the", "row", "in", "the", "database", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L1432-L1500
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.doInsert
protected function doInsert(PropelPDO $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[] = RemoteAppPeer::ID; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . RemoteAppPeer::ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(RemoteAppPeer::ID)) { $modifiedColumns[':p' . $index++] = '`id`'; } if ($this->isColumnModified(RemoteAppPeer::TYPE)) { $modifiedColumns[':p' . $index++] = '`type`'; } if ($this->isColumnModified(RemoteAppPeer::NAME)) { $modifiedColumns[':p' . $index++] = '`name`'; } if ($this->isColumnModified(RemoteAppPeer::DOMAIN)) { $modifiedColumns[':p' . $index++] = '`domain`'; } if ($this->isColumnModified(RemoteAppPeer::API_URL)) { $modifiedColumns[':p' . $index++] = '`api_url`'; } if ($this->isColumnModified(RemoteAppPeer::API_AUTH_HTTP_USER)) { $modifiedColumns[':p' . $index++] = '`api_auth_http_user`'; } if ($this->isColumnModified(RemoteAppPeer::API_AUTH_HTTP_PASSWORD)) { $modifiedColumns[':p' . $index++] = '`api_auth_http_password`'; } if ($this->isColumnModified(RemoteAppPeer::API_AUTH_TYPE)) { $modifiedColumns[':p' . $index++] = '`api_auth_type`'; } if ($this->isColumnModified(RemoteAppPeer::API_AUTH_USER)) { $modifiedColumns[':p' . $index++] = '`api_auth_user`'; } if ($this->isColumnModified(RemoteAppPeer::API_AUTH_PASSWORD)) { $modifiedColumns[':p' . $index++] = '`api_auth_password`'; } if ($this->isColumnModified(RemoteAppPeer::API_AUTH_TOKEN)) { $modifiedColumns[':p' . $index++] = '`api_auth_token`'; } if ($this->isColumnModified(RemoteAppPeer::API_AUTH_URL_USER_KEY)) { $modifiedColumns[':p' . $index++] = '`api_auth_url_user_key`'; } if ($this->isColumnModified(RemoteAppPeer::API_AUTH_URL_PW_KEY)) { $modifiedColumns[':p' . $index++] = '`api_auth_url_pw_key`'; } if ($this->isColumnModified(RemoteAppPeer::CRON)) { $modifiedColumns[':p' . $index++] = '`cron`'; } if ($this->isColumnModified(RemoteAppPeer::CUSTOMER_ID)) { $modifiedColumns[':p' . $index++] = '`customer_id`'; } if ($this->isColumnModified(RemoteAppPeer::ACTIVATED)) { $modifiedColumns[':p' . $index++] = '`activated`'; } if ($this->isColumnModified(RemoteAppPeer::NOTES)) { $modifiedColumns[':p' . $index++] = '`notes`'; } if ($this->isColumnModified(RemoteAppPeer::LAST_RUN)) { $modifiedColumns[':p' . $index++] = '`last_run`'; } if ($this->isColumnModified(RemoteAppPeer::INCLUDELOG)) { $modifiedColumns[':p' . $index++] = '`includeLog`'; } if ($this->isColumnModified(RemoteAppPeer::PUBLIC_KEY)) { $modifiedColumns[':p' . $index++] = '`public_key`'; } if ($this->isColumnModified(RemoteAppPeer::WEBSITE_HASH)) { $modifiedColumns[':p' . $index++] = '`website_hash`'; } if ($this->isColumnModified(RemoteAppPeer::NOTIFICATION_RECIPIENT)) { $modifiedColumns[':p' . $index++] = '`notification_recipient`'; } if ($this->isColumnModified(RemoteAppPeer::NOTIFICATION_SENDER)) { $modifiedColumns[':p' . $index++] = '`notification_sender`'; } if ($this->isColumnModified(RemoteAppPeer::NOTIFICATION_CHANGE)) { $modifiedColumns[':p' . $index++] = '`notification_change`'; } if ($this->isColumnModified(RemoteAppPeer::NOTIFICATION_ERROR)) { $modifiedColumns[':p' . $index++] = '`notification_error`'; } $sql = sprintf( 'INSERT INTO `remote_app` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); try { $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { case '`id`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; case '`type`': $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR); break; case '`name`': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); break; case '`domain`': $stmt->bindValue($identifier, $this->domain, PDO::PARAM_STR); break; case '`api_url`': $stmt->bindValue($identifier, $this->api_url, PDO::PARAM_STR); break; case '`api_auth_http_user`': $stmt->bindValue($identifier, $this->api_auth_http_user, PDO::PARAM_STR); break; case '`api_auth_http_password`': $stmt->bindValue($identifier, $this->api_auth_http_password, PDO::PARAM_STR); break; case '`api_auth_type`': $stmt->bindValue($identifier, $this->api_auth_type, PDO::PARAM_STR); break; case '`api_auth_user`': $stmt->bindValue($identifier, $this->api_auth_user, PDO::PARAM_STR); break; case '`api_auth_password`': $stmt->bindValue($identifier, $this->api_auth_password, PDO::PARAM_STR); break; case '`api_auth_token`': $stmt->bindValue($identifier, $this->api_auth_token, PDO::PARAM_STR); break; case '`api_auth_url_user_key`': $stmt->bindValue($identifier, $this->api_auth_url_user_key, PDO::PARAM_STR); break; case '`api_auth_url_pw_key`': $stmt->bindValue($identifier, $this->api_auth_url_pw_key, PDO::PARAM_STR); break; case '`cron`': $stmt->bindValue($identifier, $this->cron, PDO::PARAM_STR); break; case '`customer_id`': $stmt->bindValue($identifier, $this->customer_id, PDO::PARAM_INT); break; case '`activated`': $stmt->bindValue($identifier, (int) $this->activated, PDO::PARAM_INT); break; case '`notes`': $stmt->bindValue($identifier, $this->notes, PDO::PARAM_STR); break; case '`last_run`': $stmt->bindValue($identifier, $this->last_run, PDO::PARAM_STR); break; case '`includeLog`': $stmt->bindValue($identifier, (int) $this->includelog, PDO::PARAM_INT); break; case '`public_key`': $stmt->bindValue($identifier, $this->public_key, PDO::PARAM_STR); break; case '`website_hash`': $stmt->bindValue($identifier, $this->website_hash, PDO::PARAM_STR); break; case '`notification_recipient`': $stmt->bindValue($identifier, $this->notification_recipient, PDO::PARAM_STR); break; case '`notification_sender`': $stmt->bindValue($identifier, $this->notification_sender, PDO::PARAM_STR); break; case '`notification_change`': $stmt->bindValue($identifier, (int) $this->notification_change, PDO::PARAM_INT); break; case '`notification_error`': $stmt->bindValue($identifier, (int) $this->notification_error, PDO::PARAM_INT); break; } } $stmt->execute(); } catch (Exception $e) { Propel::log($e->getMessage(), Propel::LOG_ERR); throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); } try { $pk = $con->lastInsertId(); } catch (Exception $e) { throw new PropelException('Unable to get autoincrement id.', $e); } $this->setId($pk); $this->setNew(false); }
php
protected function doInsert(PropelPDO $con) { $modifiedColumns = array(); $index = 0; $this->modifiedColumns[] = RemoteAppPeer::ID; if (null !== $this->id) { throw new PropelException('Cannot insert a value for auto-increment primary key (' . RemoteAppPeer::ID . ')'); } // check the columns in natural order for more readable SQL queries if ($this->isColumnModified(RemoteAppPeer::ID)) { $modifiedColumns[':p' . $index++] = '`id`'; } if ($this->isColumnModified(RemoteAppPeer::TYPE)) { $modifiedColumns[':p' . $index++] = '`type`'; } if ($this->isColumnModified(RemoteAppPeer::NAME)) { $modifiedColumns[':p' . $index++] = '`name`'; } if ($this->isColumnModified(RemoteAppPeer::DOMAIN)) { $modifiedColumns[':p' . $index++] = '`domain`'; } if ($this->isColumnModified(RemoteAppPeer::API_URL)) { $modifiedColumns[':p' . $index++] = '`api_url`'; } if ($this->isColumnModified(RemoteAppPeer::API_AUTH_HTTP_USER)) { $modifiedColumns[':p' . $index++] = '`api_auth_http_user`'; } if ($this->isColumnModified(RemoteAppPeer::API_AUTH_HTTP_PASSWORD)) { $modifiedColumns[':p' . $index++] = '`api_auth_http_password`'; } if ($this->isColumnModified(RemoteAppPeer::API_AUTH_TYPE)) { $modifiedColumns[':p' . $index++] = '`api_auth_type`'; } if ($this->isColumnModified(RemoteAppPeer::API_AUTH_USER)) { $modifiedColumns[':p' . $index++] = '`api_auth_user`'; } if ($this->isColumnModified(RemoteAppPeer::API_AUTH_PASSWORD)) { $modifiedColumns[':p' . $index++] = '`api_auth_password`'; } if ($this->isColumnModified(RemoteAppPeer::API_AUTH_TOKEN)) { $modifiedColumns[':p' . $index++] = '`api_auth_token`'; } if ($this->isColumnModified(RemoteAppPeer::API_AUTH_URL_USER_KEY)) { $modifiedColumns[':p' . $index++] = '`api_auth_url_user_key`'; } if ($this->isColumnModified(RemoteAppPeer::API_AUTH_URL_PW_KEY)) { $modifiedColumns[':p' . $index++] = '`api_auth_url_pw_key`'; } if ($this->isColumnModified(RemoteAppPeer::CRON)) { $modifiedColumns[':p' . $index++] = '`cron`'; } if ($this->isColumnModified(RemoteAppPeer::CUSTOMER_ID)) { $modifiedColumns[':p' . $index++] = '`customer_id`'; } if ($this->isColumnModified(RemoteAppPeer::ACTIVATED)) { $modifiedColumns[':p' . $index++] = '`activated`'; } if ($this->isColumnModified(RemoteAppPeer::NOTES)) { $modifiedColumns[':p' . $index++] = '`notes`'; } if ($this->isColumnModified(RemoteAppPeer::LAST_RUN)) { $modifiedColumns[':p' . $index++] = '`last_run`'; } if ($this->isColumnModified(RemoteAppPeer::INCLUDELOG)) { $modifiedColumns[':p' . $index++] = '`includeLog`'; } if ($this->isColumnModified(RemoteAppPeer::PUBLIC_KEY)) { $modifiedColumns[':p' . $index++] = '`public_key`'; } if ($this->isColumnModified(RemoteAppPeer::WEBSITE_HASH)) { $modifiedColumns[':p' . $index++] = '`website_hash`'; } if ($this->isColumnModified(RemoteAppPeer::NOTIFICATION_RECIPIENT)) { $modifiedColumns[':p' . $index++] = '`notification_recipient`'; } if ($this->isColumnModified(RemoteAppPeer::NOTIFICATION_SENDER)) { $modifiedColumns[':p' . $index++] = '`notification_sender`'; } if ($this->isColumnModified(RemoteAppPeer::NOTIFICATION_CHANGE)) { $modifiedColumns[':p' . $index++] = '`notification_change`'; } if ($this->isColumnModified(RemoteAppPeer::NOTIFICATION_ERROR)) { $modifiedColumns[':p' . $index++] = '`notification_error`'; } $sql = sprintf( 'INSERT INTO `remote_app` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)) ); try { $stmt = $con->prepare($sql); foreach ($modifiedColumns as $identifier => $columnName) { switch ($columnName) { case '`id`': $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); break; case '`type`': $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR); break; case '`name`': $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR); break; case '`domain`': $stmt->bindValue($identifier, $this->domain, PDO::PARAM_STR); break; case '`api_url`': $stmt->bindValue($identifier, $this->api_url, PDO::PARAM_STR); break; case '`api_auth_http_user`': $stmt->bindValue($identifier, $this->api_auth_http_user, PDO::PARAM_STR); break; case '`api_auth_http_password`': $stmt->bindValue($identifier, $this->api_auth_http_password, PDO::PARAM_STR); break; case '`api_auth_type`': $stmt->bindValue($identifier, $this->api_auth_type, PDO::PARAM_STR); break; case '`api_auth_user`': $stmt->bindValue($identifier, $this->api_auth_user, PDO::PARAM_STR); break; case '`api_auth_password`': $stmt->bindValue($identifier, $this->api_auth_password, PDO::PARAM_STR); break; case '`api_auth_token`': $stmt->bindValue($identifier, $this->api_auth_token, PDO::PARAM_STR); break; case '`api_auth_url_user_key`': $stmt->bindValue($identifier, $this->api_auth_url_user_key, PDO::PARAM_STR); break; case '`api_auth_url_pw_key`': $stmt->bindValue($identifier, $this->api_auth_url_pw_key, PDO::PARAM_STR); break; case '`cron`': $stmt->bindValue($identifier, $this->cron, PDO::PARAM_STR); break; case '`customer_id`': $stmt->bindValue($identifier, $this->customer_id, PDO::PARAM_INT); break; case '`activated`': $stmt->bindValue($identifier, (int) $this->activated, PDO::PARAM_INT); break; case '`notes`': $stmt->bindValue($identifier, $this->notes, PDO::PARAM_STR); break; case '`last_run`': $stmt->bindValue($identifier, $this->last_run, PDO::PARAM_STR); break; case '`includeLog`': $stmt->bindValue($identifier, (int) $this->includelog, PDO::PARAM_INT); break; case '`public_key`': $stmt->bindValue($identifier, $this->public_key, PDO::PARAM_STR); break; case '`website_hash`': $stmt->bindValue($identifier, $this->website_hash, PDO::PARAM_STR); break; case '`notification_recipient`': $stmt->bindValue($identifier, $this->notification_recipient, PDO::PARAM_STR); break; case '`notification_sender`': $stmt->bindValue($identifier, $this->notification_sender, PDO::PARAM_STR); break; case '`notification_change`': $stmt->bindValue($identifier, (int) $this->notification_change, PDO::PARAM_INT); break; case '`notification_error`': $stmt->bindValue($identifier, (int) $this->notification_error, PDO::PARAM_INT); break; } } $stmt->execute(); } catch (Exception $e) { Propel::log($e->getMessage(), Propel::LOG_ERR); throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e); } try { $pk = $con->lastInsertId(); } catch (Exception $e) { throw new PropelException('Unable to get autoincrement id.', $e); } $this->setId($pk); $this->setNew(false); }
[ "protected", "function", "doInsert", "(", "PropelPDO", "$", "con", ")", "{", "$", "modifiedColumns", "=", "array", "(", ")", ";", "$", "index", "=", "0", ";", "$", "this", "->", "modifiedColumns", "[", "]", "=", "RemoteAppPeer", "::", "ID", ";", "if", "(", "null", "!==", "$", "this", "->", "id", ")", "{", "throw", "new", "PropelException", "(", "'Cannot insert a value for auto-increment primary key ('", ".", "RemoteAppPeer", "::", "ID", ".", "')'", ")", ";", "}", "// check the columns in natural order for more readable SQL queries", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "ID", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`id`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "TYPE", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`type`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "NAME", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`name`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "DOMAIN", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`domain`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_URL", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`api_url`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_AUTH_HTTP_USER", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`api_auth_http_user`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_AUTH_HTTP_PASSWORD", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`api_auth_http_password`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_AUTH_TYPE", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`api_auth_type`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_AUTH_USER", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`api_auth_user`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_AUTH_PASSWORD", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`api_auth_password`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_AUTH_TOKEN", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`api_auth_token`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_AUTH_URL_USER_KEY", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`api_auth_url_user_key`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_AUTH_URL_PW_KEY", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`api_auth_url_pw_key`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "CRON", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`cron`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "CUSTOMER_ID", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`customer_id`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "ACTIVATED", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`activated`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "NOTES", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`notes`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "LAST_RUN", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`last_run`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "INCLUDELOG", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`includeLog`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "PUBLIC_KEY", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`public_key`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "WEBSITE_HASH", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`website_hash`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "NOTIFICATION_RECIPIENT", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`notification_recipient`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "NOTIFICATION_SENDER", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`notification_sender`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "NOTIFICATION_CHANGE", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`notification_change`'", ";", "}", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "NOTIFICATION_ERROR", ")", ")", "{", "$", "modifiedColumns", "[", "':p'", ".", "$", "index", "++", "]", "=", "'`notification_error`'", ";", "}", "$", "sql", "=", "sprintf", "(", "'INSERT INTO `remote_app` (%s) VALUES (%s)'", ",", "implode", "(", "', '", ",", "$", "modifiedColumns", ")", ",", "implode", "(", "', '", ",", "array_keys", "(", "$", "modifiedColumns", ")", ")", ")", ";", "try", "{", "$", "stmt", "=", "$", "con", "->", "prepare", "(", "$", "sql", ")", ";", "foreach", "(", "$", "modifiedColumns", "as", "$", "identifier", "=>", "$", "columnName", ")", "{", "switch", "(", "$", "columnName", ")", "{", "case", "'`id`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "id", ",", "PDO", "::", "PARAM_INT", ")", ";", "break", ";", "case", "'`type`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "type", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`name`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "name", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`domain`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "domain", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`api_url`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "api_url", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`api_auth_http_user`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "api_auth_http_user", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`api_auth_http_password`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "api_auth_http_password", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`api_auth_type`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "api_auth_type", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`api_auth_user`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "api_auth_user", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`api_auth_password`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "api_auth_password", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`api_auth_token`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "api_auth_token", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`api_auth_url_user_key`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "api_auth_url_user_key", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`api_auth_url_pw_key`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "api_auth_url_pw_key", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`cron`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "cron", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`customer_id`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "customer_id", ",", "PDO", "::", "PARAM_INT", ")", ";", "break", ";", "case", "'`activated`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "(", "int", ")", "$", "this", "->", "activated", ",", "PDO", "::", "PARAM_INT", ")", ";", "break", ";", "case", "'`notes`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "notes", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`last_run`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "last_run", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`includeLog`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "(", "int", ")", "$", "this", "->", "includelog", ",", "PDO", "::", "PARAM_INT", ")", ";", "break", ";", "case", "'`public_key`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "public_key", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`website_hash`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "website_hash", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`notification_recipient`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "notification_recipient", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`notification_sender`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "$", "this", "->", "notification_sender", ",", "PDO", "::", "PARAM_STR", ")", ";", "break", ";", "case", "'`notification_change`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "(", "int", ")", "$", "this", "->", "notification_change", ",", "PDO", "::", "PARAM_INT", ")", ";", "break", ";", "case", "'`notification_error`'", ":", "$", "stmt", "->", "bindValue", "(", "$", "identifier", ",", "(", "int", ")", "$", "this", "->", "notification_error", ",", "PDO", "::", "PARAM_INT", ")", ";", "break", ";", "}", "}", "$", "stmt", "->", "execute", "(", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "Propel", "::", "log", "(", "$", "e", "->", "getMessage", "(", ")", ",", "Propel", "::", "LOG_ERR", ")", ";", "throw", "new", "PropelException", "(", "sprintf", "(", "'Unable to execute INSERT statement [%s]'", ",", "$", "sql", ")", ",", "$", "e", ")", ";", "}", "try", "{", "$", "pk", "=", "$", "con", "->", "lastInsertId", "(", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "throw", "new", "PropelException", "(", "'Unable to get autoincrement id.'", ",", "$", "e", ")", ";", "}", "$", "this", "->", "setId", "(", "$", "pk", ")", ";", "$", "this", "->", "setNew", "(", "false", ")", ";", "}" ]
Insert the row in the database. @param PropelPDO $con @throws PropelException @see doSave()
[ "Insert", "the", "row", "in", "the", "database", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L1510-L1698
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.doValidate
protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { $this->alreadyInValidation = true; $retval = null; $failureMap = array(); // We call the validate method on the following object(s) if they // were passed to this object by their corresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aCustomer !== null) { if (!$this->aCustomer->validate($columns)) { $failureMap = array_merge($failureMap, $this->aCustomer->getValidationFailures()); } } if (($retval = RemoteAppPeer::doValidate($this, $columns)) !== true) { $failureMap = array_merge($failureMap, $retval); } if ($this->collApiLogs !== null) { foreach ($this->collApiLogs as $referrerFK) { if (!$referrerFK->validate($columns)) { $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); } } } if ($this->collRemoteHistoryContaos !== null) { foreach ($this->collRemoteHistoryContaos as $referrerFK) { if (!$referrerFK->validate($columns)) { $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); } } } $this->alreadyInValidation = false; } return (!empty($failureMap) ? $failureMap : true); }
php
protected function doValidate($columns = null) { if (!$this->alreadyInValidation) { $this->alreadyInValidation = true; $retval = null; $failureMap = array(); // We call the validate method on the following object(s) if they // were passed to this object by their corresponding set // method. This object relates to these object(s) by a // foreign key reference. if ($this->aCustomer !== null) { if (!$this->aCustomer->validate($columns)) { $failureMap = array_merge($failureMap, $this->aCustomer->getValidationFailures()); } } if (($retval = RemoteAppPeer::doValidate($this, $columns)) !== true) { $failureMap = array_merge($failureMap, $retval); } if ($this->collApiLogs !== null) { foreach ($this->collApiLogs as $referrerFK) { if (!$referrerFK->validate($columns)) { $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); } } } if ($this->collRemoteHistoryContaos !== null) { foreach ($this->collRemoteHistoryContaos as $referrerFK) { if (!$referrerFK->validate($columns)) { $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures()); } } } $this->alreadyInValidation = false; } return (!empty($failureMap) ? $failureMap : true); }
[ "protected", "function", "doValidate", "(", "$", "columns", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "alreadyInValidation", ")", "{", "$", "this", "->", "alreadyInValidation", "=", "true", ";", "$", "retval", "=", "null", ";", "$", "failureMap", "=", "array", "(", ")", ";", "// We call the validate method on the following object(s) if they", "// were passed to this object by their corresponding set", "// method. This object relates to these object(s) by a", "// foreign key reference.", "if", "(", "$", "this", "->", "aCustomer", "!==", "null", ")", "{", "if", "(", "!", "$", "this", "->", "aCustomer", "->", "validate", "(", "$", "columns", ")", ")", "{", "$", "failureMap", "=", "array_merge", "(", "$", "failureMap", ",", "$", "this", "->", "aCustomer", "->", "getValidationFailures", "(", ")", ")", ";", "}", "}", "if", "(", "(", "$", "retval", "=", "RemoteAppPeer", "::", "doValidate", "(", "$", "this", ",", "$", "columns", ")", ")", "!==", "true", ")", "{", "$", "failureMap", "=", "array_merge", "(", "$", "failureMap", ",", "$", "retval", ")", ";", "}", "if", "(", "$", "this", "->", "collApiLogs", "!==", "null", ")", "{", "foreach", "(", "$", "this", "->", "collApiLogs", "as", "$", "referrerFK", ")", "{", "if", "(", "!", "$", "referrerFK", "->", "validate", "(", "$", "columns", ")", ")", "{", "$", "failureMap", "=", "array_merge", "(", "$", "failureMap", ",", "$", "referrerFK", "->", "getValidationFailures", "(", ")", ")", ";", "}", "}", "}", "if", "(", "$", "this", "->", "collRemoteHistoryContaos", "!==", "null", ")", "{", "foreach", "(", "$", "this", "->", "collRemoteHistoryContaos", "as", "$", "referrerFK", ")", "{", "if", "(", "!", "$", "referrerFK", "->", "validate", "(", "$", "columns", ")", ")", "{", "$", "failureMap", "=", "array_merge", "(", "$", "failureMap", ",", "$", "referrerFK", "->", "getValidationFailures", "(", ")", ")", ";", "}", "}", "}", "$", "this", "->", "alreadyInValidation", "=", "false", ";", "}", "return", "(", "!", "empty", "(", "$", "failureMap", ")", "?", "$", "failureMap", ":", "true", ")", ";", "}" ]
This function performs the validation work for complex object models. In addition to checking the current object, all related objects will also be validated. If all pass then <code>true</code> is returned; otherwise an aggregated array of ValidationFailed objects will be returned. @param array $columns Array of column names to validate. @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise.
[ "This", "function", "performs", "the", "validation", "work", "for", "complex", "object", "models", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L1767-L1814
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.getByPosition
public function getByPosition($pos) { switch ($pos) { case 0: return $this->getId(); break; case 1: return $this->getType(); break; case 2: return $this->getName(); break; case 3: return $this->getDomain(); break; case 4: return $this->getApiUrl(); break; case 5: return $this->getApiAuthHttpUser(); break; case 6: return $this->getApiAuthHttpPassword(); break; case 7: return $this->getApiAuthType(); break; case 8: return $this->getApiAuthUser(); break; case 9: return $this->getApiAuthPassword(); break; case 10: return $this->getApiAuthToken(); break; case 11: return $this->getApiAuthUrlUserKey(); break; case 12: return $this->getApiAuthUrlPwKey(); break; case 13: return $this->getCron(); break; case 14: return $this->getCustomerId(); break; case 15: return $this->getActivated(); break; case 16: return $this->getNotes(); break; case 17: return $this->getLastRun(); break; case 18: return $this->getIncludelog(); break; case 19: return $this->getPublicKey(); break; case 20: return $this->getWebsiteHash(); break; case 21: return $this->getNotificationRecipient(); break; case 22: return $this->getNotificationSender(); break; case 23: return $this->getNotificationChange(); break; case 24: return $this->getNotificationError(); break; default: return null; break; } // switch() }
php
public function getByPosition($pos) { switch ($pos) { case 0: return $this->getId(); break; case 1: return $this->getType(); break; case 2: return $this->getName(); break; case 3: return $this->getDomain(); break; case 4: return $this->getApiUrl(); break; case 5: return $this->getApiAuthHttpUser(); break; case 6: return $this->getApiAuthHttpPassword(); break; case 7: return $this->getApiAuthType(); break; case 8: return $this->getApiAuthUser(); break; case 9: return $this->getApiAuthPassword(); break; case 10: return $this->getApiAuthToken(); break; case 11: return $this->getApiAuthUrlUserKey(); break; case 12: return $this->getApiAuthUrlPwKey(); break; case 13: return $this->getCron(); break; case 14: return $this->getCustomerId(); break; case 15: return $this->getActivated(); break; case 16: return $this->getNotes(); break; case 17: return $this->getLastRun(); break; case 18: return $this->getIncludelog(); break; case 19: return $this->getPublicKey(); break; case 20: return $this->getWebsiteHash(); break; case 21: return $this->getNotificationRecipient(); break; case 22: return $this->getNotificationSender(); break; case 23: return $this->getNotificationChange(); break; case 24: return $this->getNotificationError(); break; default: return null; break; } // switch() }
[ "public", "function", "getByPosition", "(", "$", "pos", ")", "{", "switch", "(", "$", "pos", ")", "{", "case", "0", ":", "return", "$", "this", "->", "getId", "(", ")", ";", "break", ";", "case", "1", ":", "return", "$", "this", "->", "getType", "(", ")", ";", "break", ";", "case", "2", ":", "return", "$", "this", "->", "getName", "(", ")", ";", "break", ";", "case", "3", ":", "return", "$", "this", "->", "getDomain", "(", ")", ";", "break", ";", "case", "4", ":", "return", "$", "this", "->", "getApiUrl", "(", ")", ";", "break", ";", "case", "5", ":", "return", "$", "this", "->", "getApiAuthHttpUser", "(", ")", ";", "break", ";", "case", "6", ":", "return", "$", "this", "->", "getApiAuthHttpPassword", "(", ")", ";", "break", ";", "case", "7", ":", "return", "$", "this", "->", "getApiAuthType", "(", ")", ";", "break", ";", "case", "8", ":", "return", "$", "this", "->", "getApiAuthUser", "(", ")", ";", "break", ";", "case", "9", ":", "return", "$", "this", "->", "getApiAuthPassword", "(", ")", ";", "break", ";", "case", "10", ":", "return", "$", "this", "->", "getApiAuthToken", "(", ")", ";", "break", ";", "case", "11", ":", "return", "$", "this", "->", "getApiAuthUrlUserKey", "(", ")", ";", "break", ";", "case", "12", ":", "return", "$", "this", "->", "getApiAuthUrlPwKey", "(", ")", ";", "break", ";", "case", "13", ":", "return", "$", "this", "->", "getCron", "(", ")", ";", "break", ";", "case", "14", ":", "return", "$", "this", "->", "getCustomerId", "(", ")", ";", "break", ";", "case", "15", ":", "return", "$", "this", "->", "getActivated", "(", ")", ";", "break", ";", "case", "16", ":", "return", "$", "this", "->", "getNotes", "(", ")", ";", "break", ";", "case", "17", ":", "return", "$", "this", "->", "getLastRun", "(", ")", ";", "break", ";", "case", "18", ":", "return", "$", "this", "->", "getIncludelog", "(", ")", ";", "break", ";", "case", "19", ":", "return", "$", "this", "->", "getPublicKey", "(", ")", ";", "break", ";", "case", "20", ":", "return", "$", "this", "->", "getWebsiteHash", "(", ")", ";", "break", ";", "case", "21", ":", "return", "$", "this", "->", "getNotificationRecipient", "(", ")", ";", "break", ";", "case", "22", ":", "return", "$", "this", "->", "getNotificationSender", "(", ")", ";", "break", ";", "case", "23", ":", "return", "$", "this", "->", "getNotificationChange", "(", ")", ";", "break", ";", "case", "24", ":", "return", "$", "this", "->", "getNotificationError", "(", ")", ";", "break", ";", "default", ":", "return", "null", ";", "break", ";", "}", "// switch()", "}" ]
Retrieves a field from the object by Position as specified in the xml schema. Zero-based. @param int $pos position in xml schema @return mixed Value of field at $pos
[ "Retrieves", "a", "field", "from", "the", "object", "by", "Position", "as", "specified", "in", "the", "xml", "schema", ".", "Zero", "-", "based", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L1841-L1923
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.toArray
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['RemoteApp'][$this->getPrimaryKey()])) { return '*RECURSION*'; } $alreadyDumpedObjects['RemoteApp'][$this->getPrimaryKey()] = true; $keys = RemoteAppPeer::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getType(), $keys[2] => $this->getName(), $keys[3] => $this->getDomain(), $keys[4] => $this->getApiUrl(), $keys[5] => $this->getApiAuthHttpUser(), $keys[6] => $this->getApiAuthHttpPassword(), $keys[7] => $this->getApiAuthType(), $keys[8] => $this->getApiAuthUser(), $keys[9] => $this->getApiAuthPassword(), $keys[10] => $this->getApiAuthToken(), $keys[11] => $this->getApiAuthUrlUserKey(), $keys[12] => $this->getApiAuthUrlPwKey(), $keys[13] => $this->getCron(), $keys[14] => $this->getCustomerId(), $keys[15] => $this->getActivated(), $keys[16] => $this->getNotes(), $keys[17] => $this->getLastRun(), $keys[18] => $this->getIncludelog(), $keys[19] => $this->getPublicKey(), $keys[20] => $this->getWebsiteHash(), $keys[21] => $this->getNotificationRecipient(), $keys[22] => $this->getNotificationSender(), $keys[23] => $this->getNotificationChange(), $keys[24] => $this->getNotificationError(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aCustomer) { $result['Customer'] = $this->aCustomer->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->collApiLogs) { $result['ApiLogs'] = $this->collApiLogs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collRemoteHistoryContaos) { $result['RemoteHistoryContaos'] = $this->collRemoteHistoryContaos->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } } return $result; }
php
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) { if (isset($alreadyDumpedObjects['RemoteApp'][$this->getPrimaryKey()])) { return '*RECURSION*'; } $alreadyDumpedObjects['RemoteApp'][$this->getPrimaryKey()] = true; $keys = RemoteAppPeer::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getType(), $keys[2] => $this->getName(), $keys[3] => $this->getDomain(), $keys[4] => $this->getApiUrl(), $keys[5] => $this->getApiAuthHttpUser(), $keys[6] => $this->getApiAuthHttpPassword(), $keys[7] => $this->getApiAuthType(), $keys[8] => $this->getApiAuthUser(), $keys[9] => $this->getApiAuthPassword(), $keys[10] => $this->getApiAuthToken(), $keys[11] => $this->getApiAuthUrlUserKey(), $keys[12] => $this->getApiAuthUrlPwKey(), $keys[13] => $this->getCron(), $keys[14] => $this->getCustomerId(), $keys[15] => $this->getActivated(), $keys[16] => $this->getNotes(), $keys[17] => $this->getLastRun(), $keys[18] => $this->getIncludelog(), $keys[19] => $this->getPublicKey(), $keys[20] => $this->getWebsiteHash(), $keys[21] => $this->getNotificationRecipient(), $keys[22] => $this->getNotificationSender(), $keys[23] => $this->getNotificationChange(), $keys[24] => $this->getNotificationError(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { $result[$key] = $virtualColumn; } if ($includeForeignObjects) { if (null !== $this->aCustomer) { $result['Customer'] = $this->aCustomer->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); } if (null !== $this->collApiLogs) { $result['ApiLogs'] = $this->collApiLogs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } if (null !== $this->collRemoteHistoryContaos) { $result['RemoteHistoryContaos'] = $this->collRemoteHistoryContaos->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); } } return $result; }
[ "public", "function", "toArray", "(", "$", "keyType", "=", "BasePeer", "::", "TYPE_PHPNAME", ",", "$", "includeLazyLoadColumns", "=", "true", ",", "$", "alreadyDumpedObjects", "=", "array", "(", ")", ",", "$", "includeForeignObjects", "=", "false", ")", "{", "if", "(", "isset", "(", "$", "alreadyDumpedObjects", "[", "'RemoteApp'", "]", "[", "$", "this", "->", "getPrimaryKey", "(", ")", "]", ")", ")", "{", "return", "'*RECURSION*'", ";", "}", "$", "alreadyDumpedObjects", "[", "'RemoteApp'", "]", "[", "$", "this", "->", "getPrimaryKey", "(", ")", "]", "=", "true", ";", "$", "keys", "=", "RemoteAppPeer", "::", "getFieldNames", "(", "$", "keyType", ")", ";", "$", "result", "=", "array", "(", "$", "keys", "[", "0", "]", "=>", "$", "this", "->", "getId", "(", ")", ",", "$", "keys", "[", "1", "]", "=>", "$", "this", "->", "getType", "(", ")", ",", "$", "keys", "[", "2", "]", "=>", "$", "this", "->", "getName", "(", ")", ",", "$", "keys", "[", "3", "]", "=>", "$", "this", "->", "getDomain", "(", ")", ",", "$", "keys", "[", "4", "]", "=>", "$", "this", "->", "getApiUrl", "(", ")", ",", "$", "keys", "[", "5", "]", "=>", "$", "this", "->", "getApiAuthHttpUser", "(", ")", ",", "$", "keys", "[", "6", "]", "=>", "$", "this", "->", "getApiAuthHttpPassword", "(", ")", ",", "$", "keys", "[", "7", "]", "=>", "$", "this", "->", "getApiAuthType", "(", ")", ",", "$", "keys", "[", "8", "]", "=>", "$", "this", "->", "getApiAuthUser", "(", ")", ",", "$", "keys", "[", "9", "]", "=>", "$", "this", "->", "getApiAuthPassword", "(", ")", ",", "$", "keys", "[", "10", "]", "=>", "$", "this", "->", "getApiAuthToken", "(", ")", ",", "$", "keys", "[", "11", "]", "=>", "$", "this", "->", "getApiAuthUrlUserKey", "(", ")", ",", "$", "keys", "[", "12", "]", "=>", "$", "this", "->", "getApiAuthUrlPwKey", "(", ")", ",", "$", "keys", "[", "13", "]", "=>", "$", "this", "->", "getCron", "(", ")", ",", "$", "keys", "[", "14", "]", "=>", "$", "this", "->", "getCustomerId", "(", ")", ",", "$", "keys", "[", "15", "]", "=>", "$", "this", "->", "getActivated", "(", ")", ",", "$", "keys", "[", "16", "]", "=>", "$", "this", "->", "getNotes", "(", ")", ",", "$", "keys", "[", "17", "]", "=>", "$", "this", "->", "getLastRun", "(", ")", ",", "$", "keys", "[", "18", "]", "=>", "$", "this", "->", "getIncludelog", "(", ")", ",", "$", "keys", "[", "19", "]", "=>", "$", "this", "->", "getPublicKey", "(", ")", ",", "$", "keys", "[", "20", "]", "=>", "$", "this", "->", "getWebsiteHash", "(", ")", ",", "$", "keys", "[", "21", "]", "=>", "$", "this", "->", "getNotificationRecipient", "(", ")", ",", "$", "keys", "[", "22", "]", "=>", "$", "this", "->", "getNotificationSender", "(", ")", ",", "$", "keys", "[", "23", "]", "=>", "$", "this", "->", "getNotificationChange", "(", ")", ",", "$", "keys", "[", "24", "]", "=>", "$", "this", "->", "getNotificationError", "(", ")", ",", ")", ";", "$", "virtualColumns", "=", "$", "this", "->", "virtualColumns", ";", "foreach", "(", "$", "virtualColumns", "as", "$", "key", "=>", "$", "virtualColumn", ")", "{", "$", "result", "[", "$", "key", "]", "=", "$", "virtualColumn", ";", "}", "if", "(", "$", "includeForeignObjects", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "aCustomer", ")", "{", "$", "result", "[", "'Customer'", "]", "=", "$", "this", "->", "aCustomer", "->", "toArray", "(", "$", "keyType", ",", "$", "includeLazyLoadColumns", ",", "$", "alreadyDumpedObjects", ",", "true", ")", ";", "}", "if", "(", "null", "!==", "$", "this", "->", "collApiLogs", ")", "{", "$", "result", "[", "'ApiLogs'", "]", "=", "$", "this", "->", "collApiLogs", "->", "toArray", "(", "null", ",", "true", ",", "$", "keyType", ",", "$", "includeLazyLoadColumns", ",", "$", "alreadyDumpedObjects", ")", ";", "}", "if", "(", "null", "!==", "$", "this", "->", "collRemoteHistoryContaos", ")", "{", "$", "result", "[", "'RemoteHistoryContaos'", "]", "=", "$", "this", "->", "collRemoteHistoryContaos", "->", "toArray", "(", "null", ",", "true", ",", "$", "keyType", ",", "$", "includeLazyLoadColumns", ",", "$", "alreadyDumpedObjects", ")", ";", "}", "}", "return", "$", "result", ";", "}" ]
Exports the object as an array. You can specify the key type of the array by passing one of the class type constants. @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME. @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true. @param array $alreadyDumpedObjects List of objects to skip to avoid recursion @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. @return array an associative array containing the field names (as keys) and field values
[ "Exports", "the", "object", "as", "an", "array", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L1940-L1992
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setByPosition
public function setByPosition($pos, $value) { switch ($pos) { case 0: $this->setId($value); break; case 1: $this->setType($value); break; case 2: $this->setName($value); break; case 3: $this->setDomain($value); break; case 4: $this->setApiUrl($value); break; case 5: $this->setApiAuthHttpUser($value); break; case 6: $this->setApiAuthHttpPassword($value); break; case 7: $this->setApiAuthType($value); break; case 8: $this->setApiAuthUser($value); break; case 9: $this->setApiAuthPassword($value); break; case 10: $this->setApiAuthToken($value); break; case 11: $this->setApiAuthUrlUserKey($value); break; case 12: $this->setApiAuthUrlPwKey($value); break; case 13: $this->setCron($value); break; case 14: $this->setCustomerId($value); break; case 15: $this->setActivated($value); break; case 16: $this->setNotes($value); break; case 17: $this->setLastRun($value); break; case 18: $this->setIncludelog($value); break; case 19: $this->setPublicKey($value); break; case 20: $this->setWebsiteHash($value); break; case 21: $this->setNotificationRecipient($value); break; case 22: $this->setNotificationSender($value); break; case 23: $this->setNotificationChange($value); break; case 24: $this->setNotificationError($value); break; } // switch() }
php
public function setByPosition($pos, $value) { switch ($pos) { case 0: $this->setId($value); break; case 1: $this->setType($value); break; case 2: $this->setName($value); break; case 3: $this->setDomain($value); break; case 4: $this->setApiUrl($value); break; case 5: $this->setApiAuthHttpUser($value); break; case 6: $this->setApiAuthHttpPassword($value); break; case 7: $this->setApiAuthType($value); break; case 8: $this->setApiAuthUser($value); break; case 9: $this->setApiAuthPassword($value); break; case 10: $this->setApiAuthToken($value); break; case 11: $this->setApiAuthUrlUserKey($value); break; case 12: $this->setApiAuthUrlPwKey($value); break; case 13: $this->setCron($value); break; case 14: $this->setCustomerId($value); break; case 15: $this->setActivated($value); break; case 16: $this->setNotes($value); break; case 17: $this->setLastRun($value); break; case 18: $this->setIncludelog($value); break; case 19: $this->setPublicKey($value); break; case 20: $this->setWebsiteHash($value); break; case 21: $this->setNotificationRecipient($value); break; case 22: $this->setNotificationSender($value); break; case 23: $this->setNotificationChange($value); break; case 24: $this->setNotificationError($value); break; } // switch() }
[ "public", "function", "setByPosition", "(", "$", "pos", ",", "$", "value", ")", "{", "switch", "(", "$", "pos", ")", "{", "case", "0", ":", "$", "this", "->", "setId", "(", "$", "value", ")", ";", "break", ";", "case", "1", ":", "$", "this", "->", "setType", "(", "$", "value", ")", ";", "break", ";", "case", "2", ":", "$", "this", "->", "setName", "(", "$", "value", ")", ";", "break", ";", "case", "3", ":", "$", "this", "->", "setDomain", "(", "$", "value", ")", ";", "break", ";", "case", "4", ":", "$", "this", "->", "setApiUrl", "(", "$", "value", ")", ";", "break", ";", "case", "5", ":", "$", "this", "->", "setApiAuthHttpUser", "(", "$", "value", ")", ";", "break", ";", "case", "6", ":", "$", "this", "->", "setApiAuthHttpPassword", "(", "$", "value", ")", ";", "break", ";", "case", "7", ":", "$", "this", "->", "setApiAuthType", "(", "$", "value", ")", ";", "break", ";", "case", "8", ":", "$", "this", "->", "setApiAuthUser", "(", "$", "value", ")", ";", "break", ";", "case", "9", ":", "$", "this", "->", "setApiAuthPassword", "(", "$", "value", ")", ";", "break", ";", "case", "10", ":", "$", "this", "->", "setApiAuthToken", "(", "$", "value", ")", ";", "break", ";", "case", "11", ":", "$", "this", "->", "setApiAuthUrlUserKey", "(", "$", "value", ")", ";", "break", ";", "case", "12", ":", "$", "this", "->", "setApiAuthUrlPwKey", "(", "$", "value", ")", ";", "break", ";", "case", "13", ":", "$", "this", "->", "setCron", "(", "$", "value", ")", ";", "break", ";", "case", "14", ":", "$", "this", "->", "setCustomerId", "(", "$", "value", ")", ";", "break", ";", "case", "15", ":", "$", "this", "->", "setActivated", "(", "$", "value", ")", ";", "break", ";", "case", "16", ":", "$", "this", "->", "setNotes", "(", "$", "value", ")", ";", "break", ";", "case", "17", ":", "$", "this", "->", "setLastRun", "(", "$", "value", ")", ";", "break", ";", "case", "18", ":", "$", "this", "->", "setIncludelog", "(", "$", "value", ")", ";", "break", ";", "case", "19", ":", "$", "this", "->", "setPublicKey", "(", "$", "value", ")", ";", "break", ";", "case", "20", ":", "$", "this", "->", "setWebsiteHash", "(", "$", "value", ")", ";", "break", ";", "case", "21", ":", "$", "this", "->", "setNotificationRecipient", "(", "$", "value", ")", ";", "break", ";", "case", "22", ":", "$", "this", "->", "setNotificationSender", "(", "$", "value", ")", ";", "break", ";", "case", "23", ":", "$", "this", "->", "setNotificationChange", "(", "$", "value", ")", ";", "break", ";", "case", "24", ":", "$", "this", "->", "setNotificationError", "(", "$", "value", ")", ";", "break", ";", "}", "// switch()", "}" ]
Sets a field from the object by Position as specified in the xml schema. Zero-based. @param int $pos position in xml schema @param mixed $value field value @return void
[ "Sets", "a", "field", "from", "the", "object", "by", "Position", "as", "specified", "in", "the", "xml", "schema", ".", "Zero", "-", "based", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L2020-L2099
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.fromArray
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RemoteAppPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setType($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setName($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setDomain($arr[$keys[3]]); if (array_key_exists($keys[4], $arr)) $this->setApiUrl($arr[$keys[4]]); if (array_key_exists($keys[5], $arr)) $this->setApiAuthHttpUser($arr[$keys[5]]); if (array_key_exists($keys[6], $arr)) $this->setApiAuthHttpPassword($arr[$keys[6]]); if (array_key_exists($keys[7], $arr)) $this->setApiAuthType($arr[$keys[7]]); if (array_key_exists($keys[8], $arr)) $this->setApiAuthUser($arr[$keys[8]]); if (array_key_exists($keys[9], $arr)) $this->setApiAuthPassword($arr[$keys[9]]); if (array_key_exists($keys[10], $arr)) $this->setApiAuthToken($arr[$keys[10]]); if (array_key_exists($keys[11], $arr)) $this->setApiAuthUrlUserKey($arr[$keys[11]]); if (array_key_exists($keys[12], $arr)) $this->setApiAuthUrlPwKey($arr[$keys[12]]); if (array_key_exists($keys[13], $arr)) $this->setCron($arr[$keys[13]]); if (array_key_exists($keys[14], $arr)) $this->setCustomerId($arr[$keys[14]]); if (array_key_exists($keys[15], $arr)) $this->setActivated($arr[$keys[15]]); if (array_key_exists($keys[16], $arr)) $this->setNotes($arr[$keys[16]]); if (array_key_exists($keys[17], $arr)) $this->setLastRun($arr[$keys[17]]); if (array_key_exists($keys[18], $arr)) $this->setIncludelog($arr[$keys[18]]); if (array_key_exists($keys[19], $arr)) $this->setPublicKey($arr[$keys[19]]); if (array_key_exists($keys[20], $arr)) $this->setWebsiteHash($arr[$keys[20]]); if (array_key_exists($keys[21], $arr)) $this->setNotificationRecipient($arr[$keys[21]]); if (array_key_exists($keys[22], $arr)) $this->setNotificationSender($arr[$keys[22]]); if (array_key_exists($keys[23], $arr)) $this->setNotificationChange($arr[$keys[23]]); if (array_key_exists($keys[24], $arr)) $this->setNotificationError($arr[$keys[24]]); }
php
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = RemoteAppPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setType($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setName($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setDomain($arr[$keys[3]]); if (array_key_exists($keys[4], $arr)) $this->setApiUrl($arr[$keys[4]]); if (array_key_exists($keys[5], $arr)) $this->setApiAuthHttpUser($arr[$keys[5]]); if (array_key_exists($keys[6], $arr)) $this->setApiAuthHttpPassword($arr[$keys[6]]); if (array_key_exists($keys[7], $arr)) $this->setApiAuthType($arr[$keys[7]]); if (array_key_exists($keys[8], $arr)) $this->setApiAuthUser($arr[$keys[8]]); if (array_key_exists($keys[9], $arr)) $this->setApiAuthPassword($arr[$keys[9]]); if (array_key_exists($keys[10], $arr)) $this->setApiAuthToken($arr[$keys[10]]); if (array_key_exists($keys[11], $arr)) $this->setApiAuthUrlUserKey($arr[$keys[11]]); if (array_key_exists($keys[12], $arr)) $this->setApiAuthUrlPwKey($arr[$keys[12]]); if (array_key_exists($keys[13], $arr)) $this->setCron($arr[$keys[13]]); if (array_key_exists($keys[14], $arr)) $this->setCustomerId($arr[$keys[14]]); if (array_key_exists($keys[15], $arr)) $this->setActivated($arr[$keys[15]]); if (array_key_exists($keys[16], $arr)) $this->setNotes($arr[$keys[16]]); if (array_key_exists($keys[17], $arr)) $this->setLastRun($arr[$keys[17]]); if (array_key_exists($keys[18], $arr)) $this->setIncludelog($arr[$keys[18]]); if (array_key_exists($keys[19], $arr)) $this->setPublicKey($arr[$keys[19]]); if (array_key_exists($keys[20], $arr)) $this->setWebsiteHash($arr[$keys[20]]); if (array_key_exists($keys[21], $arr)) $this->setNotificationRecipient($arr[$keys[21]]); if (array_key_exists($keys[22], $arr)) $this->setNotificationSender($arr[$keys[22]]); if (array_key_exists($keys[23], $arr)) $this->setNotificationChange($arr[$keys[23]]); if (array_key_exists($keys[24], $arr)) $this->setNotificationError($arr[$keys[24]]); }
[ "public", "function", "fromArray", "(", "$", "arr", ",", "$", "keyType", "=", "BasePeer", "::", "TYPE_PHPNAME", ")", "{", "$", "keys", "=", "RemoteAppPeer", "::", "getFieldNames", "(", "$", "keyType", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "0", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setId", "(", "$", "arr", "[", "$", "keys", "[", "0", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "1", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setType", "(", "$", "arr", "[", "$", "keys", "[", "1", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "2", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setName", "(", "$", "arr", "[", "$", "keys", "[", "2", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "3", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setDomain", "(", "$", "arr", "[", "$", "keys", "[", "3", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "4", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setApiUrl", "(", "$", "arr", "[", "$", "keys", "[", "4", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "5", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setApiAuthHttpUser", "(", "$", "arr", "[", "$", "keys", "[", "5", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "6", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setApiAuthHttpPassword", "(", "$", "arr", "[", "$", "keys", "[", "6", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "7", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setApiAuthType", "(", "$", "arr", "[", "$", "keys", "[", "7", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "8", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setApiAuthUser", "(", "$", "arr", "[", "$", "keys", "[", "8", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "9", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setApiAuthPassword", "(", "$", "arr", "[", "$", "keys", "[", "9", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "10", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setApiAuthToken", "(", "$", "arr", "[", "$", "keys", "[", "10", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "11", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setApiAuthUrlUserKey", "(", "$", "arr", "[", "$", "keys", "[", "11", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "12", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setApiAuthUrlPwKey", "(", "$", "arr", "[", "$", "keys", "[", "12", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "13", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setCron", "(", "$", "arr", "[", "$", "keys", "[", "13", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "14", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setCustomerId", "(", "$", "arr", "[", "$", "keys", "[", "14", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "15", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setActivated", "(", "$", "arr", "[", "$", "keys", "[", "15", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "16", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setNotes", "(", "$", "arr", "[", "$", "keys", "[", "16", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "17", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setLastRun", "(", "$", "arr", "[", "$", "keys", "[", "17", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "18", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setIncludelog", "(", "$", "arr", "[", "$", "keys", "[", "18", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "19", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setPublicKey", "(", "$", "arr", "[", "$", "keys", "[", "19", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "20", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setWebsiteHash", "(", "$", "arr", "[", "$", "keys", "[", "20", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "21", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setNotificationRecipient", "(", "$", "arr", "[", "$", "keys", "[", "21", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "22", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setNotificationSender", "(", "$", "arr", "[", "$", "keys", "[", "22", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "23", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setNotificationChange", "(", "$", "arr", "[", "$", "keys", "[", "23", "]", "]", ")", ";", "if", "(", "array_key_exists", "(", "$", "keys", "[", "24", "]", ",", "$", "arr", ")", ")", "$", "this", "->", "setNotificationError", "(", "$", "arr", "[", "$", "keys", "[", "24", "]", "]", ")", ";", "}" ]
Populates the object using an array. This is particularly useful when populating an object from one of the request arrays (e.g. $_POST). This method goes through the column names, checking to see whether a matching key exists in populated array. If so the setByName() method is called for that column. You can specify the key type of the array by additionally passing one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. The default key type is the column's BasePeer::TYPE_PHPNAME @param array $arr An array to populate the object from. @param string $keyType The type of keys the array uses. @return void
[ "Populates", "the", "object", "using", "an", "array", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L2118-L2147
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.buildCriteria
public function buildCriteria() { $criteria = new Criteria(RemoteAppPeer::DATABASE_NAME); if ($this->isColumnModified(RemoteAppPeer::ID)) $criteria->add(RemoteAppPeer::ID, $this->id); if ($this->isColumnModified(RemoteAppPeer::TYPE)) $criteria->add(RemoteAppPeer::TYPE, $this->type); if ($this->isColumnModified(RemoteAppPeer::NAME)) $criteria->add(RemoteAppPeer::NAME, $this->name); if ($this->isColumnModified(RemoteAppPeer::DOMAIN)) $criteria->add(RemoteAppPeer::DOMAIN, $this->domain); if ($this->isColumnModified(RemoteAppPeer::API_URL)) $criteria->add(RemoteAppPeer::API_URL, $this->api_url); if ($this->isColumnModified(RemoteAppPeer::API_AUTH_HTTP_USER)) $criteria->add(RemoteAppPeer::API_AUTH_HTTP_USER, $this->api_auth_http_user); if ($this->isColumnModified(RemoteAppPeer::API_AUTH_HTTP_PASSWORD)) $criteria->add(RemoteAppPeer::API_AUTH_HTTP_PASSWORD, $this->api_auth_http_password); if ($this->isColumnModified(RemoteAppPeer::API_AUTH_TYPE)) $criteria->add(RemoteAppPeer::API_AUTH_TYPE, $this->api_auth_type); if ($this->isColumnModified(RemoteAppPeer::API_AUTH_USER)) $criteria->add(RemoteAppPeer::API_AUTH_USER, $this->api_auth_user); if ($this->isColumnModified(RemoteAppPeer::API_AUTH_PASSWORD)) $criteria->add(RemoteAppPeer::API_AUTH_PASSWORD, $this->api_auth_password); if ($this->isColumnModified(RemoteAppPeer::API_AUTH_TOKEN)) $criteria->add(RemoteAppPeer::API_AUTH_TOKEN, $this->api_auth_token); if ($this->isColumnModified(RemoteAppPeer::API_AUTH_URL_USER_KEY)) $criteria->add(RemoteAppPeer::API_AUTH_URL_USER_KEY, $this->api_auth_url_user_key); if ($this->isColumnModified(RemoteAppPeer::API_AUTH_URL_PW_KEY)) $criteria->add(RemoteAppPeer::API_AUTH_URL_PW_KEY, $this->api_auth_url_pw_key); if ($this->isColumnModified(RemoteAppPeer::CRON)) $criteria->add(RemoteAppPeer::CRON, $this->cron); if ($this->isColumnModified(RemoteAppPeer::CUSTOMER_ID)) $criteria->add(RemoteAppPeer::CUSTOMER_ID, $this->customer_id); if ($this->isColumnModified(RemoteAppPeer::ACTIVATED)) $criteria->add(RemoteAppPeer::ACTIVATED, $this->activated); if ($this->isColumnModified(RemoteAppPeer::NOTES)) $criteria->add(RemoteAppPeer::NOTES, $this->notes); if ($this->isColumnModified(RemoteAppPeer::LAST_RUN)) $criteria->add(RemoteAppPeer::LAST_RUN, $this->last_run); if ($this->isColumnModified(RemoteAppPeer::INCLUDELOG)) $criteria->add(RemoteAppPeer::INCLUDELOG, $this->includelog); if ($this->isColumnModified(RemoteAppPeer::PUBLIC_KEY)) $criteria->add(RemoteAppPeer::PUBLIC_KEY, $this->public_key); if ($this->isColumnModified(RemoteAppPeer::WEBSITE_HASH)) $criteria->add(RemoteAppPeer::WEBSITE_HASH, $this->website_hash); if ($this->isColumnModified(RemoteAppPeer::NOTIFICATION_RECIPIENT)) $criteria->add(RemoteAppPeer::NOTIFICATION_RECIPIENT, $this->notification_recipient); if ($this->isColumnModified(RemoteAppPeer::NOTIFICATION_SENDER)) $criteria->add(RemoteAppPeer::NOTIFICATION_SENDER, $this->notification_sender); if ($this->isColumnModified(RemoteAppPeer::NOTIFICATION_CHANGE)) $criteria->add(RemoteAppPeer::NOTIFICATION_CHANGE, $this->notification_change); if ($this->isColumnModified(RemoteAppPeer::NOTIFICATION_ERROR)) $criteria->add(RemoteAppPeer::NOTIFICATION_ERROR, $this->notification_error); return $criteria; }
php
public function buildCriteria() { $criteria = new Criteria(RemoteAppPeer::DATABASE_NAME); if ($this->isColumnModified(RemoteAppPeer::ID)) $criteria->add(RemoteAppPeer::ID, $this->id); if ($this->isColumnModified(RemoteAppPeer::TYPE)) $criteria->add(RemoteAppPeer::TYPE, $this->type); if ($this->isColumnModified(RemoteAppPeer::NAME)) $criteria->add(RemoteAppPeer::NAME, $this->name); if ($this->isColumnModified(RemoteAppPeer::DOMAIN)) $criteria->add(RemoteAppPeer::DOMAIN, $this->domain); if ($this->isColumnModified(RemoteAppPeer::API_URL)) $criteria->add(RemoteAppPeer::API_URL, $this->api_url); if ($this->isColumnModified(RemoteAppPeer::API_AUTH_HTTP_USER)) $criteria->add(RemoteAppPeer::API_AUTH_HTTP_USER, $this->api_auth_http_user); if ($this->isColumnModified(RemoteAppPeer::API_AUTH_HTTP_PASSWORD)) $criteria->add(RemoteAppPeer::API_AUTH_HTTP_PASSWORD, $this->api_auth_http_password); if ($this->isColumnModified(RemoteAppPeer::API_AUTH_TYPE)) $criteria->add(RemoteAppPeer::API_AUTH_TYPE, $this->api_auth_type); if ($this->isColumnModified(RemoteAppPeer::API_AUTH_USER)) $criteria->add(RemoteAppPeer::API_AUTH_USER, $this->api_auth_user); if ($this->isColumnModified(RemoteAppPeer::API_AUTH_PASSWORD)) $criteria->add(RemoteAppPeer::API_AUTH_PASSWORD, $this->api_auth_password); if ($this->isColumnModified(RemoteAppPeer::API_AUTH_TOKEN)) $criteria->add(RemoteAppPeer::API_AUTH_TOKEN, $this->api_auth_token); if ($this->isColumnModified(RemoteAppPeer::API_AUTH_URL_USER_KEY)) $criteria->add(RemoteAppPeer::API_AUTH_URL_USER_KEY, $this->api_auth_url_user_key); if ($this->isColumnModified(RemoteAppPeer::API_AUTH_URL_PW_KEY)) $criteria->add(RemoteAppPeer::API_AUTH_URL_PW_KEY, $this->api_auth_url_pw_key); if ($this->isColumnModified(RemoteAppPeer::CRON)) $criteria->add(RemoteAppPeer::CRON, $this->cron); if ($this->isColumnModified(RemoteAppPeer::CUSTOMER_ID)) $criteria->add(RemoteAppPeer::CUSTOMER_ID, $this->customer_id); if ($this->isColumnModified(RemoteAppPeer::ACTIVATED)) $criteria->add(RemoteAppPeer::ACTIVATED, $this->activated); if ($this->isColumnModified(RemoteAppPeer::NOTES)) $criteria->add(RemoteAppPeer::NOTES, $this->notes); if ($this->isColumnModified(RemoteAppPeer::LAST_RUN)) $criteria->add(RemoteAppPeer::LAST_RUN, $this->last_run); if ($this->isColumnModified(RemoteAppPeer::INCLUDELOG)) $criteria->add(RemoteAppPeer::INCLUDELOG, $this->includelog); if ($this->isColumnModified(RemoteAppPeer::PUBLIC_KEY)) $criteria->add(RemoteAppPeer::PUBLIC_KEY, $this->public_key); if ($this->isColumnModified(RemoteAppPeer::WEBSITE_HASH)) $criteria->add(RemoteAppPeer::WEBSITE_HASH, $this->website_hash); if ($this->isColumnModified(RemoteAppPeer::NOTIFICATION_RECIPIENT)) $criteria->add(RemoteAppPeer::NOTIFICATION_RECIPIENT, $this->notification_recipient); if ($this->isColumnModified(RemoteAppPeer::NOTIFICATION_SENDER)) $criteria->add(RemoteAppPeer::NOTIFICATION_SENDER, $this->notification_sender); if ($this->isColumnModified(RemoteAppPeer::NOTIFICATION_CHANGE)) $criteria->add(RemoteAppPeer::NOTIFICATION_CHANGE, $this->notification_change); if ($this->isColumnModified(RemoteAppPeer::NOTIFICATION_ERROR)) $criteria->add(RemoteAppPeer::NOTIFICATION_ERROR, $this->notification_error); return $criteria; }
[ "public", "function", "buildCriteria", "(", ")", "{", "$", "criteria", "=", "new", "Criteria", "(", "RemoteAppPeer", "::", "DATABASE_NAME", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "ID", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "ID", ",", "$", "this", "->", "id", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "TYPE", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "TYPE", ",", "$", "this", "->", "type", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "NAME", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "NAME", ",", "$", "this", "->", "name", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "DOMAIN", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "DOMAIN", ",", "$", "this", "->", "domain", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_URL", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "API_URL", ",", "$", "this", "->", "api_url", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_AUTH_HTTP_USER", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "API_AUTH_HTTP_USER", ",", "$", "this", "->", "api_auth_http_user", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_AUTH_HTTP_PASSWORD", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "API_AUTH_HTTP_PASSWORD", ",", "$", "this", "->", "api_auth_http_password", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_AUTH_TYPE", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "API_AUTH_TYPE", ",", "$", "this", "->", "api_auth_type", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_AUTH_USER", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "API_AUTH_USER", ",", "$", "this", "->", "api_auth_user", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_AUTH_PASSWORD", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "API_AUTH_PASSWORD", ",", "$", "this", "->", "api_auth_password", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_AUTH_TOKEN", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "API_AUTH_TOKEN", ",", "$", "this", "->", "api_auth_token", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_AUTH_URL_USER_KEY", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "API_AUTH_URL_USER_KEY", ",", "$", "this", "->", "api_auth_url_user_key", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "API_AUTH_URL_PW_KEY", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "API_AUTH_URL_PW_KEY", ",", "$", "this", "->", "api_auth_url_pw_key", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "CRON", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "CRON", ",", "$", "this", "->", "cron", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "CUSTOMER_ID", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "CUSTOMER_ID", ",", "$", "this", "->", "customer_id", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "ACTIVATED", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "ACTIVATED", ",", "$", "this", "->", "activated", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "NOTES", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "NOTES", ",", "$", "this", "->", "notes", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "LAST_RUN", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "LAST_RUN", ",", "$", "this", "->", "last_run", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "INCLUDELOG", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "INCLUDELOG", ",", "$", "this", "->", "includelog", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "PUBLIC_KEY", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "PUBLIC_KEY", ",", "$", "this", "->", "public_key", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "WEBSITE_HASH", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "WEBSITE_HASH", ",", "$", "this", "->", "website_hash", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "NOTIFICATION_RECIPIENT", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "NOTIFICATION_RECIPIENT", ",", "$", "this", "->", "notification_recipient", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "NOTIFICATION_SENDER", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "NOTIFICATION_SENDER", ",", "$", "this", "->", "notification_sender", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "NOTIFICATION_CHANGE", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "NOTIFICATION_CHANGE", ",", "$", "this", "->", "notification_change", ")", ";", "if", "(", "$", "this", "->", "isColumnModified", "(", "RemoteAppPeer", "::", "NOTIFICATION_ERROR", ")", ")", "$", "criteria", "->", "add", "(", "RemoteAppPeer", "::", "NOTIFICATION_ERROR", ",", "$", "this", "->", "notification_error", ")", ";", "return", "$", "criteria", ";", "}" ]
Build a Criteria object containing the values of all modified columns in this object. @return Criteria The Criteria object containing all modified values.
[ "Build", "a", "Criteria", "object", "containing", "the", "values", "of", "all", "modified", "columns", "in", "this", "object", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L2154-L2185
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.copyInto
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setType($this->getType()); $copyObj->setName($this->getName()); $copyObj->setDomain($this->getDomain()); $copyObj->setApiUrl($this->getApiUrl()); $copyObj->setApiAuthHttpUser($this->getApiAuthHttpUser()); $copyObj->setApiAuthHttpPassword($this->getApiAuthHttpPassword()); $copyObj->setApiAuthType($this->getApiAuthType()); $copyObj->setApiAuthUser($this->getApiAuthUser()); $copyObj->setApiAuthPassword($this->getApiAuthPassword()); $copyObj->setApiAuthToken($this->getApiAuthToken()); $copyObj->setApiAuthUrlUserKey($this->getApiAuthUrlUserKey()); $copyObj->setApiAuthUrlPwKey($this->getApiAuthUrlPwKey()); $copyObj->setCron($this->getCron()); $copyObj->setCustomerId($this->getCustomerId()); $copyObj->setActivated($this->getActivated()); $copyObj->setNotes($this->getNotes()); $copyObj->setLastRun($this->getLastRun()); $copyObj->setIncludelog($this->getIncludelog()); $copyObj->setPublicKey($this->getPublicKey()); $copyObj->setWebsiteHash($this->getWebsiteHash()); $copyObj->setNotificationRecipient($this->getNotificationRecipient()); $copyObj->setNotificationSender($this->getNotificationSender()); $copyObj->setNotificationChange($this->getNotificationChange()); $copyObj->setNotificationError($this->getNotificationError()); if ($deepCopy && !$this->startCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); // store object hash to prevent cycle $this->startCopy = true; foreach ($this->getApiLogs() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addApiLog($relObj->copy($deepCopy)); } } foreach ($this->getRemoteHistoryContaos() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addRemoteHistoryContao($relObj->copy($deepCopy)); } } //unflag object copy $this->startCopy = false; } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }
php
public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setType($this->getType()); $copyObj->setName($this->getName()); $copyObj->setDomain($this->getDomain()); $copyObj->setApiUrl($this->getApiUrl()); $copyObj->setApiAuthHttpUser($this->getApiAuthHttpUser()); $copyObj->setApiAuthHttpPassword($this->getApiAuthHttpPassword()); $copyObj->setApiAuthType($this->getApiAuthType()); $copyObj->setApiAuthUser($this->getApiAuthUser()); $copyObj->setApiAuthPassword($this->getApiAuthPassword()); $copyObj->setApiAuthToken($this->getApiAuthToken()); $copyObj->setApiAuthUrlUserKey($this->getApiAuthUrlUserKey()); $copyObj->setApiAuthUrlPwKey($this->getApiAuthUrlPwKey()); $copyObj->setCron($this->getCron()); $copyObj->setCustomerId($this->getCustomerId()); $copyObj->setActivated($this->getActivated()); $copyObj->setNotes($this->getNotes()); $copyObj->setLastRun($this->getLastRun()); $copyObj->setIncludelog($this->getIncludelog()); $copyObj->setPublicKey($this->getPublicKey()); $copyObj->setWebsiteHash($this->getWebsiteHash()); $copyObj->setNotificationRecipient($this->getNotificationRecipient()); $copyObj->setNotificationSender($this->getNotificationSender()); $copyObj->setNotificationChange($this->getNotificationChange()); $copyObj->setNotificationError($this->getNotificationError()); if ($deepCopy && !$this->startCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); // store object hash to prevent cycle $this->startCopy = true; foreach ($this->getApiLogs() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addApiLog($relObj->copy($deepCopy)); } } foreach ($this->getRemoteHistoryContaos() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addRemoteHistoryContao($relObj->copy($deepCopy)); } } //unflag object copy $this->startCopy = false; } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }
[ "public", "function", "copyInto", "(", "$", "copyObj", ",", "$", "deepCopy", "=", "false", ",", "$", "makeNew", "=", "true", ")", "{", "$", "copyObj", "->", "setType", "(", "$", "this", "->", "getType", "(", ")", ")", ";", "$", "copyObj", "->", "setName", "(", "$", "this", "->", "getName", "(", ")", ")", ";", "$", "copyObj", "->", "setDomain", "(", "$", "this", "->", "getDomain", "(", ")", ")", ";", "$", "copyObj", "->", "setApiUrl", "(", "$", "this", "->", "getApiUrl", "(", ")", ")", ";", "$", "copyObj", "->", "setApiAuthHttpUser", "(", "$", "this", "->", "getApiAuthHttpUser", "(", ")", ")", ";", "$", "copyObj", "->", "setApiAuthHttpPassword", "(", "$", "this", "->", "getApiAuthHttpPassword", "(", ")", ")", ";", "$", "copyObj", "->", "setApiAuthType", "(", "$", "this", "->", "getApiAuthType", "(", ")", ")", ";", "$", "copyObj", "->", "setApiAuthUser", "(", "$", "this", "->", "getApiAuthUser", "(", ")", ")", ";", "$", "copyObj", "->", "setApiAuthPassword", "(", "$", "this", "->", "getApiAuthPassword", "(", ")", ")", ";", "$", "copyObj", "->", "setApiAuthToken", "(", "$", "this", "->", "getApiAuthToken", "(", ")", ")", ";", "$", "copyObj", "->", "setApiAuthUrlUserKey", "(", "$", "this", "->", "getApiAuthUrlUserKey", "(", ")", ")", ";", "$", "copyObj", "->", "setApiAuthUrlPwKey", "(", "$", "this", "->", "getApiAuthUrlPwKey", "(", ")", ")", ";", "$", "copyObj", "->", "setCron", "(", "$", "this", "->", "getCron", "(", ")", ")", ";", "$", "copyObj", "->", "setCustomerId", "(", "$", "this", "->", "getCustomerId", "(", ")", ")", ";", "$", "copyObj", "->", "setActivated", "(", "$", "this", "->", "getActivated", "(", ")", ")", ";", "$", "copyObj", "->", "setNotes", "(", "$", "this", "->", "getNotes", "(", ")", ")", ";", "$", "copyObj", "->", "setLastRun", "(", "$", "this", "->", "getLastRun", "(", ")", ")", ";", "$", "copyObj", "->", "setIncludelog", "(", "$", "this", "->", "getIncludelog", "(", ")", ")", ";", "$", "copyObj", "->", "setPublicKey", "(", "$", "this", "->", "getPublicKey", "(", ")", ")", ";", "$", "copyObj", "->", "setWebsiteHash", "(", "$", "this", "->", "getWebsiteHash", "(", ")", ")", ";", "$", "copyObj", "->", "setNotificationRecipient", "(", "$", "this", "->", "getNotificationRecipient", "(", ")", ")", ";", "$", "copyObj", "->", "setNotificationSender", "(", "$", "this", "->", "getNotificationSender", "(", ")", ")", ";", "$", "copyObj", "->", "setNotificationChange", "(", "$", "this", "->", "getNotificationChange", "(", ")", ")", ";", "$", "copyObj", "->", "setNotificationError", "(", "$", "this", "->", "getNotificationError", "(", ")", ")", ";", "if", "(", "$", "deepCopy", "&&", "!", "$", "this", "->", "startCopy", ")", "{", "// important: temporarily setNew(false) because this affects the behavior of", "// the getter/setter methods for fkey referrer objects.", "$", "copyObj", "->", "setNew", "(", "false", ")", ";", "// store object hash to prevent cycle", "$", "this", "->", "startCopy", "=", "true", ";", "foreach", "(", "$", "this", "->", "getApiLogs", "(", ")", "as", "$", "relObj", ")", "{", "if", "(", "$", "relObj", "!==", "$", "this", ")", "{", "// ensure that we don't try to copy a reference to ourselves", "$", "copyObj", "->", "addApiLog", "(", "$", "relObj", "->", "copy", "(", "$", "deepCopy", ")", ")", ";", "}", "}", "foreach", "(", "$", "this", "->", "getRemoteHistoryContaos", "(", ")", "as", "$", "relObj", ")", "{", "if", "(", "$", "relObj", "!==", "$", "this", ")", "{", "// ensure that we don't try to copy a reference to ourselves", "$", "copyObj", "->", "addRemoteHistoryContao", "(", "$", "relObj", "->", "copy", "(", "$", "deepCopy", ")", ")", ";", "}", "}", "//unflag object copy", "$", "this", "->", "startCopy", "=", "false", ";", "}", "// if ($deepCopy)", "if", "(", "$", "makeNew", ")", "{", "$", "copyObj", "->", "setNew", "(", "true", ")", ";", "$", "copyObj", "->", "setId", "(", "NULL", ")", ";", "// this is a auto-increment column, so set to default value", "}", "}" ]
Sets contents of passed object to values from current object. If desired, this method can also make copies of all associated (fkey referrers) objects. @param object $copyObj An object of RemoteApp (or compatible) type. @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. @throws PropelException
[ "Sets", "contents", "of", "passed", "object", "to", "values", "from", "current", "object", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L2244-L2298
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.initApiLogs
public function initApiLogs($overrideExisting = true) { if (null !== $this->collApiLogs && !$overrideExisting) { return; } $this->collApiLogs = new PropelObjectCollection(); $this->collApiLogs->setModel('ApiLog'); }
php
public function initApiLogs($overrideExisting = true) { if (null !== $this->collApiLogs && !$overrideExisting) { return; } $this->collApiLogs = new PropelObjectCollection(); $this->collApiLogs->setModel('ApiLog'); }
[ "public", "function", "initApiLogs", "(", "$", "overrideExisting", "=", "true", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "collApiLogs", "&&", "!", "$", "overrideExisting", ")", "{", "return", ";", "}", "$", "this", "->", "collApiLogs", "=", "new", "PropelObjectCollection", "(", ")", ";", "$", "this", "->", "collApiLogs", "->", "setModel", "(", "'ApiLog'", ")", ";", "}" ]
Initializes the collApiLogs collection. By default this just sets the collApiLogs collection to an empty array (like clearcollApiLogs()); however, you may wish to override this method in your stub class to provide setting appropriate to your application -- for example, setting the initial array to the values stored in database. @param boolean $overrideExisting If set to true, the method call initializes the collection even if it is not empty @return void
[ "Initializes", "the", "collApiLogs", "collection", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L2450-L2457
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.getApiLogs
public function getApiLogs($criteria = null, PropelPDO $con = null) { $partial = $this->collApiLogsPartial && !$this->isNew(); if (null === $this->collApiLogs || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collApiLogs) { // return empty collection $this->initApiLogs(); } else { $collApiLogs = ApiLogQuery::create(null, $criteria) ->filterByRemoteApp($this) ->find($con); if (null !== $criteria) { if (false !== $this->collApiLogsPartial && count($collApiLogs)) { $this->initApiLogs(false); foreach ($collApiLogs as $obj) { if (false == $this->collApiLogs->contains($obj)) { $this->collApiLogs->append($obj); } } $this->collApiLogsPartial = true; } $collApiLogs->getInternalIterator()->rewind(); return $collApiLogs; } if ($partial && $this->collApiLogs) { foreach ($this->collApiLogs as $obj) { if ($obj->isNew()) { $collApiLogs[] = $obj; } } } $this->collApiLogs = $collApiLogs; $this->collApiLogsPartial = false; } } return $this->collApiLogs; }
php
public function getApiLogs($criteria = null, PropelPDO $con = null) { $partial = $this->collApiLogsPartial && !$this->isNew(); if (null === $this->collApiLogs || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collApiLogs) { // return empty collection $this->initApiLogs(); } else { $collApiLogs = ApiLogQuery::create(null, $criteria) ->filterByRemoteApp($this) ->find($con); if (null !== $criteria) { if (false !== $this->collApiLogsPartial && count($collApiLogs)) { $this->initApiLogs(false); foreach ($collApiLogs as $obj) { if (false == $this->collApiLogs->contains($obj)) { $this->collApiLogs->append($obj); } } $this->collApiLogsPartial = true; } $collApiLogs->getInternalIterator()->rewind(); return $collApiLogs; } if ($partial && $this->collApiLogs) { foreach ($this->collApiLogs as $obj) { if ($obj->isNew()) { $collApiLogs[] = $obj; } } } $this->collApiLogs = $collApiLogs; $this->collApiLogsPartial = false; } } return $this->collApiLogs; }
[ "public", "function", "getApiLogs", "(", "$", "criteria", "=", "null", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "$", "partial", "=", "$", "this", "->", "collApiLogsPartial", "&&", "!", "$", "this", "->", "isNew", "(", ")", ";", "if", "(", "null", "===", "$", "this", "->", "collApiLogs", "||", "null", "!==", "$", "criteria", "||", "$", "partial", ")", "{", "if", "(", "$", "this", "->", "isNew", "(", ")", "&&", "null", "===", "$", "this", "->", "collApiLogs", ")", "{", "// return empty collection", "$", "this", "->", "initApiLogs", "(", ")", ";", "}", "else", "{", "$", "collApiLogs", "=", "ApiLogQuery", "::", "create", "(", "null", ",", "$", "criteria", ")", "->", "filterByRemoteApp", "(", "$", "this", ")", "->", "find", "(", "$", "con", ")", ";", "if", "(", "null", "!==", "$", "criteria", ")", "{", "if", "(", "false", "!==", "$", "this", "->", "collApiLogsPartial", "&&", "count", "(", "$", "collApiLogs", ")", ")", "{", "$", "this", "->", "initApiLogs", "(", "false", ")", ";", "foreach", "(", "$", "collApiLogs", "as", "$", "obj", ")", "{", "if", "(", "false", "==", "$", "this", "->", "collApiLogs", "->", "contains", "(", "$", "obj", ")", ")", "{", "$", "this", "->", "collApiLogs", "->", "append", "(", "$", "obj", ")", ";", "}", "}", "$", "this", "->", "collApiLogsPartial", "=", "true", ";", "}", "$", "collApiLogs", "->", "getInternalIterator", "(", ")", "->", "rewind", "(", ")", ";", "return", "$", "collApiLogs", ";", "}", "if", "(", "$", "partial", "&&", "$", "this", "->", "collApiLogs", ")", "{", "foreach", "(", "$", "this", "->", "collApiLogs", "as", "$", "obj", ")", "{", "if", "(", "$", "obj", "->", "isNew", "(", ")", ")", "{", "$", "collApiLogs", "[", "]", "=", "$", "obj", ";", "}", "}", "}", "$", "this", "->", "collApiLogs", "=", "$", "collApiLogs", ";", "$", "this", "->", "collApiLogsPartial", "=", "false", ";", "}", "}", "return", "$", "this", "->", "collApiLogs", ";", "}" ]
Gets an array of ApiLog objects which contain a foreign key that references this object. If the $criteria is not null, it is used to always fetch the results from the database. Otherwise the results are fetched from the database the first time, then cached. Next time the same method is called without $criteria, the cached collection is returned. If this RemoteApp is new, it will return an empty collection or the current collection; the criteria is ignored on a new object. @param Criteria $criteria optional Criteria object to narrow the query @param PropelPDO $con optional connection object @return PropelObjectCollection|ApiLog[] List of ApiLog objects @throws PropelException
[ "Gets", "an", "array", "of", "ApiLog", "objects", "which", "contain", "a", "foreign", "key", "that", "references", "this", "object", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L2473-L2516
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setApiLogs
public function setApiLogs(PropelCollection $apiLogs, PropelPDO $con = null) { $apiLogsToDelete = $this->getApiLogs(new Criteria(), $con)->diff($apiLogs); $this->apiLogsScheduledForDeletion = $apiLogsToDelete; foreach ($apiLogsToDelete as $apiLogRemoved) { $apiLogRemoved->setRemoteApp(null); } $this->collApiLogs = null; foreach ($apiLogs as $apiLog) { $this->addApiLog($apiLog); } $this->collApiLogs = $apiLogs; $this->collApiLogsPartial = false; return $this; }
php
public function setApiLogs(PropelCollection $apiLogs, PropelPDO $con = null) { $apiLogsToDelete = $this->getApiLogs(new Criteria(), $con)->diff($apiLogs); $this->apiLogsScheduledForDeletion = $apiLogsToDelete; foreach ($apiLogsToDelete as $apiLogRemoved) { $apiLogRemoved->setRemoteApp(null); } $this->collApiLogs = null; foreach ($apiLogs as $apiLog) { $this->addApiLog($apiLog); } $this->collApiLogs = $apiLogs; $this->collApiLogsPartial = false; return $this; }
[ "public", "function", "setApiLogs", "(", "PropelCollection", "$", "apiLogs", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "$", "apiLogsToDelete", "=", "$", "this", "->", "getApiLogs", "(", "new", "Criteria", "(", ")", ",", "$", "con", ")", "->", "diff", "(", "$", "apiLogs", ")", ";", "$", "this", "->", "apiLogsScheduledForDeletion", "=", "$", "apiLogsToDelete", ";", "foreach", "(", "$", "apiLogsToDelete", "as", "$", "apiLogRemoved", ")", "{", "$", "apiLogRemoved", "->", "setRemoteApp", "(", "null", ")", ";", "}", "$", "this", "->", "collApiLogs", "=", "null", ";", "foreach", "(", "$", "apiLogs", "as", "$", "apiLog", ")", "{", "$", "this", "->", "addApiLog", "(", "$", "apiLog", ")", ";", "}", "$", "this", "->", "collApiLogs", "=", "$", "apiLogs", ";", "$", "this", "->", "collApiLogsPartial", "=", "false", ";", "return", "$", "this", ";", "}" ]
Sets a collection of ApiLog objects related by a one-to-many relationship to the current object. It will also schedule objects for deletion based on a diff between old objects (aka persisted) and new objects from the given Propel collection. @param PropelCollection $apiLogs A Propel collection. @param PropelPDO $con Optional connection object @return RemoteApp The current object (for fluent API support)
[ "Sets", "a", "collection", "of", "ApiLog", "objects", "related", "by", "a", "one", "-", "to", "-", "many", "relationship", "to", "the", "current", "object", ".", "It", "will", "also", "schedule", "objects", "for", "deletion", "based", "on", "a", "diff", "between", "old", "objects", "(", "aka", "persisted", ")", "and", "new", "objects", "from", "the", "given", "Propel", "collection", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L2528-L2548
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.countApiLogs
public function countApiLogs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { $partial = $this->collApiLogsPartial && !$this->isNew(); if (null === $this->collApiLogs || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collApiLogs) { return 0; } if ($partial && !$criteria) { return count($this->getApiLogs()); } $query = ApiLogQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query ->filterByRemoteApp($this) ->count($con); } return count($this->collApiLogs); }
php
public function countApiLogs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { $partial = $this->collApiLogsPartial && !$this->isNew(); if (null === $this->collApiLogs || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collApiLogs) { return 0; } if ($partial && !$criteria) { return count($this->getApiLogs()); } $query = ApiLogQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query ->filterByRemoteApp($this) ->count($con); } return count($this->collApiLogs); }
[ "public", "function", "countApiLogs", "(", "Criteria", "$", "criteria", "=", "null", ",", "$", "distinct", "=", "false", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "$", "partial", "=", "$", "this", "->", "collApiLogsPartial", "&&", "!", "$", "this", "->", "isNew", "(", ")", ";", "if", "(", "null", "===", "$", "this", "->", "collApiLogs", "||", "null", "!==", "$", "criteria", "||", "$", "partial", ")", "{", "if", "(", "$", "this", "->", "isNew", "(", ")", "&&", "null", "===", "$", "this", "->", "collApiLogs", ")", "{", "return", "0", ";", "}", "if", "(", "$", "partial", "&&", "!", "$", "criteria", ")", "{", "return", "count", "(", "$", "this", "->", "getApiLogs", "(", ")", ")", ";", "}", "$", "query", "=", "ApiLogQuery", "::", "create", "(", "null", ",", "$", "criteria", ")", ";", "if", "(", "$", "distinct", ")", "{", "$", "query", "->", "distinct", "(", ")", ";", "}", "return", "$", "query", "->", "filterByRemoteApp", "(", "$", "this", ")", "->", "count", "(", "$", "con", ")", ";", "}", "return", "count", "(", "$", "this", "->", "collApiLogs", ")", ";", "}" ]
Returns the number of related ApiLog objects. @param Criteria $criteria @param boolean $distinct @param PropelPDO $con @return int Count of related ApiLog objects. @throws PropelException
[ "Returns", "the", "number", "of", "related", "ApiLog", "objects", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L2559-L2581
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.addApiLog
public function addApiLog(ApiLog $l) { if ($this->collApiLogs === null) { $this->initApiLogs(); $this->collApiLogsPartial = true; } if (!in_array($l, $this->collApiLogs->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddApiLog($l); if ($this->apiLogsScheduledForDeletion and $this->apiLogsScheduledForDeletion->contains($l)) { $this->apiLogsScheduledForDeletion->remove($this->apiLogsScheduledForDeletion->search($l)); } } return $this; }
php
public function addApiLog(ApiLog $l) { if ($this->collApiLogs === null) { $this->initApiLogs(); $this->collApiLogsPartial = true; } if (!in_array($l, $this->collApiLogs->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddApiLog($l); if ($this->apiLogsScheduledForDeletion and $this->apiLogsScheduledForDeletion->contains($l)) { $this->apiLogsScheduledForDeletion->remove($this->apiLogsScheduledForDeletion->search($l)); } } return $this; }
[ "public", "function", "addApiLog", "(", "ApiLog", "$", "l", ")", "{", "if", "(", "$", "this", "->", "collApiLogs", "===", "null", ")", "{", "$", "this", "->", "initApiLogs", "(", ")", ";", "$", "this", "->", "collApiLogsPartial", "=", "true", ";", "}", "if", "(", "!", "in_array", "(", "$", "l", ",", "$", "this", "->", "collApiLogs", "->", "getArrayCopy", "(", ")", ",", "true", ")", ")", "{", "// only add it if the **same** object is not already associated", "$", "this", "->", "doAddApiLog", "(", "$", "l", ")", ";", "if", "(", "$", "this", "->", "apiLogsScheduledForDeletion", "and", "$", "this", "->", "apiLogsScheduledForDeletion", "->", "contains", "(", "$", "l", ")", ")", "{", "$", "this", "->", "apiLogsScheduledForDeletion", "->", "remove", "(", "$", "this", "->", "apiLogsScheduledForDeletion", "->", "search", "(", "$", "l", ")", ")", ";", "}", "}", "return", "$", "this", ";", "}" ]
Method called to associate a ApiLog object to this object through the ApiLog foreign key attribute. @param ApiLog $l ApiLog @return RemoteApp The current object (for fluent API support)
[ "Method", "called", "to", "associate", "a", "ApiLog", "object", "to", "this", "object", "through", "the", "ApiLog", "foreign", "key", "attribute", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L2590-L2606
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.initRemoteHistoryContaos
public function initRemoteHistoryContaos($overrideExisting = true) { if (null !== $this->collRemoteHistoryContaos && !$overrideExisting) { return; } $this->collRemoteHistoryContaos = new PropelObjectCollection(); $this->collRemoteHistoryContaos->setModel('RemoteHistoryContao'); }
php
public function initRemoteHistoryContaos($overrideExisting = true) { if (null !== $this->collRemoteHistoryContaos && !$overrideExisting) { return; } $this->collRemoteHistoryContaos = new PropelObjectCollection(); $this->collRemoteHistoryContaos->setModel('RemoteHistoryContao'); }
[ "public", "function", "initRemoteHistoryContaos", "(", "$", "overrideExisting", "=", "true", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "collRemoteHistoryContaos", "&&", "!", "$", "overrideExisting", ")", "{", "return", ";", "}", "$", "this", "->", "collRemoteHistoryContaos", "=", "new", "PropelObjectCollection", "(", ")", ";", "$", "this", "->", "collRemoteHistoryContaos", "->", "setModel", "(", "'RemoteHistoryContao'", ")", ";", "}" ]
Initializes the collRemoteHistoryContaos collection. By default this just sets the collRemoteHistoryContaos collection to an empty array (like clearcollRemoteHistoryContaos()); however, you may wish to override this method in your stub class to provide setting appropriate to your application -- for example, setting the initial array to the values stored in database. @param boolean $overrideExisting If set to true, the method call initializes the collection even if it is not empty @return void
[ "Initializes", "the", "collRemoteHistoryContaos", "collection", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L2675-L2682
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.getRemoteHistoryContaos
public function getRemoteHistoryContaos($criteria = null, PropelPDO $con = null) { $partial = $this->collRemoteHistoryContaosPartial && !$this->isNew(); if (null === $this->collRemoteHistoryContaos || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collRemoteHistoryContaos) { // return empty collection $this->initRemoteHistoryContaos(); } else { $collRemoteHistoryContaos = RemoteHistoryContaoQuery::create(null, $criteria) ->filterByRemoteApp($this) ->find($con); if (null !== $criteria) { if (false !== $this->collRemoteHistoryContaosPartial && count($collRemoteHistoryContaos)) { $this->initRemoteHistoryContaos(false); foreach ($collRemoteHistoryContaos as $obj) { if (false == $this->collRemoteHistoryContaos->contains($obj)) { $this->collRemoteHistoryContaos->append($obj); } } $this->collRemoteHistoryContaosPartial = true; } $collRemoteHistoryContaos->getInternalIterator()->rewind(); return $collRemoteHistoryContaos; } if ($partial && $this->collRemoteHistoryContaos) { foreach ($this->collRemoteHistoryContaos as $obj) { if ($obj->isNew()) { $collRemoteHistoryContaos[] = $obj; } } } $this->collRemoteHistoryContaos = $collRemoteHistoryContaos; $this->collRemoteHistoryContaosPartial = false; } } return $this->collRemoteHistoryContaos; }
php
public function getRemoteHistoryContaos($criteria = null, PropelPDO $con = null) { $partial = $this->collRemoteHistoryContaosPartial && !$this->isNew(); if (null === $this->collRemoteHistoryContaos || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collRemoteHistoryContaos) { // return empty collection $this->initRemoteHistoryContaos(); } else { $collRemoteHistoryContaos = RemoteHistoryContaoQuery::create(null, $criteria) ->filterByRemoteApp($this) ->find($con); if (null !== $criteria) { if (false !== $this->collRemoteHistoryContaosPartial && count($collRemoteHistoryContaos)) { $this->initRemoteHistoryContaos(false); foreach ($collRemoteHistoryContaos as $obj) { if (false == $this->collRemoteHistoryContaos->contains($obj)) { $this->collRemoteHistoryContaos->append($obj); } } $this->collRemoteHistoryContaosPartial = true; } $collRemoteHistoryContaos->getInternalIterator()->rewind(); return $collRemoteHistoryContaos; } if ($partial && $this->collRemoteHistoryContaos) { foreach ($this->collRemoteHistoryContaos as $obj) { if ($obj->isNew()) { $collRemoteHistoryContaos[] = $obj; } } } $this->collRemoteHistoryContaos = $collRemoteHistoryContaos; $this->collRemoteHistoryContaosPartial = false; } } return $this->collRemoteHistoryContaos; }
[ "public", "function", "getRemoteHistoryContaos", "(", "$", "criteria", "=", "null", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "$", "partial", "=", "$", "this", "->", "collRemoteHistoryContaosPartial", "&&", "!", "$", "this", "->", "isNew", "(", ")", ";", "if", "(", "null", "===", "$", "this", "->", "collRemoteHistoryContaos", "||", "null", "!==", "$", "criteria", "||", "$", "partial", ")", "{", "if", "(", "$", "this", "->", "isNew", "(", ")", "&&", "null", "===", "$", "this", "->", "collRemoteHistoryContaos", ")", "{", "// return empty collection", "$", "this", "->", "initRemoteHistoryContaos", "(", ")", ";", "}", "else", "{", "$", "collRemoteHistoryContaos", "=", "RemoteHistoryContaoQuery", "::", "create", "(", "null", ",", "$", "criteria", ")", "->", "filterByRemoteApp", "(", "$", "this", ")", "->", "find", "(", "$", "con", ")", ";", "if", "(", "null", "!==", "$", "criteria", ")", "{", "if", "(", "false", "!==", "$", "this", "->", "collRemoteHistoryContaosPartial", "&&", "count", "(", "$", "collRemoteHistoryContaos", ")", ")", "{", "$", "this", "->", "initRemoteHistoryContaos", "(", "false", ")", ";", "foreach", "(", "$", "collRemoteHistoryContaos", "as", "$", "obj", ")", "{", "if", "(", "false", "==", "$", "this", "->", "collRemoteHistoryContaos", "->", "contains", "(", "$", "obj", ")", ")", "{", "$", "this", "->", "collRemoteHistoryContaos", "->", "append", "(", "$", "obj", ")", ";", "}", "}", "$", "this", "->", "collRemoteHistoryContaosPartial", "=", "true", ";", "}", "$", "collRemoteHistoryContaos", "->", "getInternalIterator", "(", ")", "->", "rewind", "(", ")", ";", "return", "$", "collRemoteHistoryContaos", ";", "}", "if", "(", "$", "partial", "&&", "$", "this", "->", "collRemoteHistoryContaos", ")", "{", "foreach", "(", "$", "this", "->", "collRemoteHistoryContaos", "as", "$", "obj", ")", "{", "if", "(", "$", "obj", "->", "isNew", "(", ")", ")", "{", "$", "collRemoteHistoryContaos", "[", "]", "=", "$", "obj", ";", "}", "}", "}", "$", "this", "->", "collRemoteHistoryContaos", "=", "$", "collRemoteHistoryContaos", ";", "$", "this", "->", "collRemoteHistoryContaosPartial", "=", "false", ";", "}", "}", "return", "$", "this", "->", "collRemoteHistoryContaos", ";", "}" ]
Gets an array of RemoteHistoryContao objects which contain a foreign key that references this object. If the $criteria is not null, it is used to always fetch the results from the database. Otherwise the results are fetched from the database the first time, then cached. Next time the same method is called without $criteria, the cached collection is returned. If this RemoteApp is new, it will return an empty collection or the current collection; the criteria is ignored on a new object. @param Criteria $criteria optional Criteria object to narrow the query @param PropelPDO $con optional connection object @return PropelObjectCollection|RemoteHistoryContao[] List of RemoteHistoryContao objects @throws PropelException
[ "Gets", "an", "array", "of", "RemoteHistoryContao", "objects", "which", "contain", "a", "foreign", "key", "that", "references", "this", "object", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L2698-L2741
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.setRemoteHistoryContaos
public function setRemoteHistoryContaos(PropelCollection $remoteHistoryContaos, PropelPDO $con = null) { $remoteHistoryContaosToDelete = $this->getRemoteHistoryContaos(new Criteria(), $con)->diff($remoteHistoryContaos); $this->remoteHistoryContaosScheduledForDeletion = $remoteHistoryContaosToDelete; foreach ($remoteHistoryContaosToDelete as $remoteHistoryContaoRemoved) { $remoteHistoryContaoRemoved->setRemoteApp(null); } $this->collRemoteHistoryContaos = null; foreach ($remoteHistoryContaos as $remoteHistoryContao) { $this->addRemoteHistoryContao($remoteHistoryContao); } $this->collRemoteHistoryContaos = $remoteHistoryContaos; $this->collRemoteHistoryContaosPartial = false; return $this; }
php
public function setRemoteHistoryContaos(PropelCollection $remoteHistoryContaos, PropelPDO $con = null) { $remoteHistoryContaosToDelete = $this->getRemoteHistoryContaos(new Criteria(), $con)->diff($remoteHistoryContaos); $this->remoteHistoryContaosScheduledForDeletion = $remoteHistoryContaosToDelete; foreach ($remoteHistoryContaosToDelete as $remoteHistoryContaoRemoved) { $remoteHistoryContaoRemoved->setRemoteApp(null); } $this->collRemoteHistoryContaos = null; foreach ($remoteHistoryContaos as $remoteHistoryContao) { $this->addRemoteHistoryContao($remoteHistoryContao); } $this->collRemoteHistoryContaos = $remoteHistoryContaos; $this->collRemoteHistoryContaosPartial = false; return $this; }
[ "public", "function", "setRemoteHistoryContaos", "(", "PropelCollection", "$", "remoteHistoryContaos", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "$", "remoteHistoryContaosToDelete", "=", "$", "this", "->", "getRemoteHistoryContaos", "(", "new", "Criteria", "(", ")", ",", "$", "con", ")", "->", "diff", "(", "$", "remoteHistoryContaos", ")", ";", "$", "this", "->", "remoteHistoryContaosScheduledForDeletion", "=", "$", "remoteHistoryContaosToDelete", ";", "foreach", "(", "$", "remoteHistoryContaosToDelete", "as", "$", "remoteHistoryContaoRemoved", ")", "{", "$", "remoteHistoryContaoRemoved", "->", "setRemoteApp", "(", "null", ")", ";", "}", "$", "this", "->", "collRemoteHistoryContaos", "=", "null", ";", "foreach", "(", "$", "remoteHistoryContaos", "as", "$", "remoteHistoryContao", ")", "{", "$", "this", "->", "addRemoteHistoryContao", "(", "$", "remoteHistoryContao", ")", ";", "}", "$", "this", "->", "collRemoteHistoryContaos", "=", "$", "remoteHistoryContaos", ";", "$", "this", "->", "collRemoteHistoryContaosPartial", "=", "false", ";", "return", "$", "this", ";", "}" ]
Sets a collection of RemoteHistoryContao objects related by a one-to-many relationship to the current object. It will also schedule objects for deletion based on a diff between old objects (aka persisted) and new objects from the given Propel collection. @param PropelCollection $remoteHistoryContaos A Propel collection. @param PropelPDO $con Optional connection object @return RemoteApp The current object (for fluent API support)
[ "Sets", "a", "collection", "of", "RemoteHistoryContao", "objects", "related", "by", "a", "one", "-", "to", "-", "many", "relationship", "to", "the", "current", "object", ".", "It", "will", "also", "schedule", "objects", "for", "deletion", "based", "on", "a", "diff", "between", "old", "objects", "(", "aka", "persisted", ")", "and", "new", "objects", "from", "the", "given", "Propel", "collection", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L2753-L2773
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.countRemoteHistoryContaos
public function countRemoteHistoryContaos(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { $partial = $this->collRemoteHistoryContaosPartial && !$this->isNew(); if (null === $this->collRemoteHistoryContaos || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collRemoteHistoryContaos) { return 0; } if ($partial && !$criteria) { return count($this->getRemoteHistoryContaos()); } $query = RemoteHistoryContaoQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query ->filterByRemoteApp($this) ->count($con); } return count($this->collRemoteHistoryContaos); }
php
public function countRemoteHistoryContaos(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { $partial = $this->collRemoteHistoryContaosPartial && !$this->isNew(); if (null === $this->collRemoteHistoryContaos || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collRemoteHistoryContaos) { return 0; } if ($partial && !$criteria) { return count($this->getRemoteHistoryContaos()); } $query = RemoteHistoryContaoQuery::create(null, $criteria); if ($distinct) { $query->distinct(); } return $query ->filterByRemoteApp($this) ->count($con); } return count($this->collRemoteHistoryContaos); }
[ "public", "function", "countRemoteHistoryContaos", "(", "Criteria", "$", "criteria", "=", "null", ",", "$", "distinct", "=", "false", ",", "PropelPDO", "$", "con", "=", "null", ")", "{", "$", "partial", "=", "$", "this", "->", "collRemoteHistoryContaosPartial", "&&", "!", "$", "this", "->", "isNew", "(", ")", ";", "if", "(", "null", "===", "$", "this", "->", "collRemoteHistoryContaos", "||", "null", "!==", "$", "criteria", "||", "$", "partial", ")", "{", "if", "(", "$", "this", "->", "isNew", "(", ")", "&&", "null", "===", "$", "this", "->", "collRemoteHistoryContaos", ")", "{", "return", "0", ";", "}", "if", "(", "$", "partial", "&&", "!", "$", "criteria", ")", "{", "return", "count", "(", "$", "this", "->", "getRemoteHistoryContaos", "(", ")", ")", ";", "}", "$", "query", "=", "RemoteHistoryContaoQuery", "::", "create", "(", "null", ",", "$", "criteria", ")", ";", "if", "(", "$", "distinct", ")", "{", "$", "query", "->", "distinct", "(", ")", ";", "}", "return", "$", "query", "->", "filterByRemoteApp", "(", "$", "this", ")", "->", "count", "(", "$", "con", ")", ";", "}", "return", "count", "(", "$", "this", "->", "collRemoteHistoryContaos", ")", ";", "}" ]
Returns the number of related RemoteHistoryContao objects. @param Criteria $criteria @param boolean $distinct @param PropelPDO $con @return int Count of related RemoteHistoryContao objects. @throws PropelException
[ "Returns", "the", "number", "of", "related", "RemoteHistoryContao", "objects", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L2784-L2806
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.addRemoteHistoryContao
public function addRemoteHistoryContao(RemoteHistoryContao $l) { if ($this->collRemoteHistoryContaos === null) { $this->initRemoteHistoryContaos(); $this->collRemoteHistoryContaosPartial = true; } if (!in_array($l, $this->collRemoteHistoryContaos->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddRemoteHistoryContao($l); if ($this->remoteHistoryContaosScheduledForDeletion and $this->remoteHistoryContaosScheduledForDeletion->contains($l)) { $this->remoteHistoryContaosScheduledForDeletion->remove($this->remoteHistoryContaosScheduledForDeletion->search($l)); } } return $this; }
php
public function addRemoteHistoryContao(RemoteHistoryContao $l) { if ($this->collRemoteHistoryContaos === null) { $this->initRemoteHistoryContaos(); $this->collRemoteHistoryContaosPartial = true; } if (!in_array($l, $this->collRemoteHistoryContaos->getArrayCopy(), true)) { // only add it if the **same** object is not already associated $this->doAddRemoteHistoryContao($l); if ($this->remoteHistoryContaosScheduledForDeletion and $this->remoteHistoryContaosScheduledForDeletion->contains($l)) { $this->remoteHistoryContaosScheduledForDeletion->remove($this->remoteHistoryContaosScheduledForDeletion->search($l)); } } return $this; }
[ "public", "function", "addRemoteHistoryContao", "(", "RemoteHistoryContao", "$", "l", ")", "{", "if", "(", "$", "this", "->", "collRemoteHistoryContaos", "===", "null", ")", "{", "$", "this", "->", "initRemoteHistoryContaos", "(", ")", ";", "$", "this", "->", "collRemoteHistoryContaosPartial", "=", "true", ";", "}", "if", "(", "!", "in_array", "(", "$", "l", ",", "$", "this", "->", "collRemoteHistoryContaos", "->", "getArrayCopy", "(", ")", ",", "true", ")", ")", "{", "// only add it if the **same** object is not already associated", "$", "this", "->", "doAddRemoteHistoryContao", "(", "$", "l", ")", ";", "if", "(", "$", "this", "->", "remoteHistoryContaosScheduledForDeletion", "and", "$", "this", "->", "remoteHistoryContaosScheduledForDeletion", "->", "contains", "(", "$", "l", ")", ")", "{", "$", "this", "->", "remoteHistoryContaosScheduledForDeletion", "->", "remove", "(", "$", "this", "->", "remoteHistoryContaosScheduledForDeletion", "->", "search", "(", "$", "l", ")", ")", ";", "}", "}", "return", "$", "this", ";", "}" ]
Method called to associate a RemoteHistoryContao object to this object through the RemoteHistoryContao foreign key attribute. @param RemoteHistoryContao $l RemoteHistoryContao @return RemoteApp The current object (for fluent API support)
[ "Method", "called", "to", "associate", "a", "RemoteHistoryContao", "object", "to", "this", "object", "through", "the", "RemoteHistoryContao", "foreign", "key", "attribute", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L2815-L2831
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.clear
public function clear() { $this->id = null; $this->type = null; $this->name = null; $this->domain = null; $this->api_url = null; $this->api_auth_http_user = null; $this->api_auth_http_password = null; $this->api_auth_type = null; $this->api_auth_user = null; $this->api_auth_password = null; $this->api_auth_token = null; $this->api_auth_url_user_key = null; $this->api_auth_url_pw_key = null; $this->cron = null; $this->customer_id = null; $this->activated = null; $this->notes = null; $this->last_run = null; $this->includelog = null; $this->public_key = null; $this->website_hash = null; $this->notification_recipient = null; $this->notification_sender = null; $this->notification_change = null; $this->notification_error = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->alreadyInClearAllReferencesDeep = false; $this->clearAllReferences(); $this->applyDefaultValues(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); }
php
public function clear() { $this->id = null; $this->type = null; $this->name = null; $this->domain = null; $this->api_url = null; $this->api_auth_http_user = null; $this->api_auth_http_password = null; $this->api_auth_type = null; $this->api_auth_user = null; $this->api_auth_password = null; $this->api_auth_token = null; $this->api_auth_url_user_key = null; $this->api_auth_url_pw_key = null; $this->cron = null; $this->customer_id = null; $this->activated = null; $this->notes = null; $this->last_run = null; $this->includelog = null; $this->public_key = null; $this->website_hash = null; $this->notification_recipient = null; $this->notification_sender = null; $this->notification_change = null; $this->notification_error = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->alreadyInClearAllReferencesDeep = false; $this->clearAllReferences(); $this->applyDefaultValues(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); }
[ "public", "function", "clear", "(", ")", "{", "$", "this", "->", "id", "=", "null", ";", "$", "this", "->", "type", "=", "null", ";", "$", "this", "->", "name", "=", "null", ";", "$", "this", "->", "domain", "=", "null", ";", "$", "this", "->", "api_url", "=", "null", ";", "$", "this", "->", "api_auth_http_user", "=", "null", ";", "$", "this", "->", "api_auth_http_password", "=", "null", ";", "$", "this", "->", "api_auth_type", "=", "null", ";", "$", "this", "->", "api_auth_user", "=", "null", ";", "$", "this", "->", "api_auth_password", "=", "null", ";", "$", "this", "->", "api_auth_token", "=", "null", ";", "$", "this", "->", "api_auth_url_user_key", "=", "null", ";", "$", "this", "->", "api_auth_url_pw_key", "=", "null", ";", "$", "this", "->", "cron", "=", "null", ";", "$", "this", "->", "customer_id", "=", "null", ";", "$", "this", "->", "activated", "=", "null", ";", "$", "this", "->", "notes", "=", "null", ";", "$", "this", "->", "last_run", "=", "null", ";", "$", "this", "->", "includelog", "=", "null", ";", "$", "this", "->", "public_key", "=", "null", ";", "$", "this", "->", "website_hash", "=", "null", ";", "$", "this", "->", "notification_recipient", "=", "null", ";", "$", "this", "->", "notification_sender", "=", "null", ";", "$", "this", "->", "notification_change", "=", "null", ";", "$", "this", "->", "notification_error", "=", "null", ";", "$", "this", "->", "alreadyInSave", "=", "false", ";", "$", "this", "->", "alreadyInValidation", "=", "false", ";", "$", "this", "->", "alreadyInClearAllReferencesDeep", "=", "false", ";", "$", "this", "->", "clearAllReferences", "(", ")", ";", "$", "this", "->", "applyDefaultValues", "(", ")", ";", "$", "this", "->", "resetModified", "(", ")", ";", "$", "this", "->", "setNew", "(", "true", ")", ";", "$", "this", "->", "setDeleted", "(", "false", ")", ";", "}" ]
Clears the current object and sets all attributes to their default values
[ "Clears", "the", "current", "object", "and", "sets", "all", "attributes", "to", "their", "default", "values" ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L2864-L2899
slashworks/control-bundle
src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php
BaseRemoteApp.clearAllReferences
public function clearAllReferences($deep = false) { if ($deep && !$this->alreadyInClearAllReferencesDeep) { $this->alreadyInClearAllReferencesDeep = true; if ($this->collApiLogs) { foreach ($this->collApiLogs as $o) { $o->clearAllReferences($deep); } } if ($this->collRemoteHistoryContaos) { foreach ($this->collRemoteHistoryContaos as $o) { $o->clearAllReferences($deep); } } if ($this->aCustomer instanceof Persistent) { $this->aCustomer->clearAllReferences($deep); } $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) if ($this->collApiLogs instanceof PropelCollection) { $this->collApiLogs->clearIterator(); } $this->collApiLogs = null; if ($this->collRemoteHistoryContaos instanceof PropelCollection) { $this->collRemoteHistoryContaos->clearIterator(); } $this->collRemoteHistoryContaos = null; $this->aCustomer = null; }
php
public function clearAllReferences($deep = false) { if ($deep && !$this->alreadyInClearAllReferencesDeep) { $this->alreadyInClearAllReferencesDeep = true; if ($this->collApiLogs) { foreach ($this->collApiLogs as $o) { $o->clearAllReferences($deep); } } if ($this->collRemoteHistoryContaos) { foreach ($this->collRemoteHistoryContaos as $o) { $o->clearAllReferences($deep); } } if ($this->aCustomer instanceof Persistent) { $this->aCustomer->clearAllReferences($deep); } $this->alreadyInClearAllReferencesDeep = false; } // if ($deep) if ($this->collApiLogs instanceof PropelCollection) { $this->collApiLogs->clearIterator(); } $this->collApiLogs = null; if ($this->collRemoteHistoryContaos instanceof PropelCollection) { $this->collRemoteHistoryContaos->clearIterator(); } $this->collRemoteHistoryContaos = null; $this->aCustomer = null; }
[ "public", "function", "clearAllReferences", "(", "$", "deep", "=", "false", ")", "{", "if", "(", "$", "deep", "&&", "!", "$", "this", "->", "alreadyInClearAllReferencesDeep", ")", "{", "$", "this", "->", "alreadyInClearAllReferencesDeep", "=", "true", ";", "if", "(", "$", "this", "->", "collApiLogs", ")", "{", "foreach", "(", "$", "this", "->", "collApiLogs", "as", "$", "o", ")", "{", "$", "o", "->", "clearAllReferences", "(", "$", "deep", ")", ";", "}", "}", "if", "(", "$", "this", "->", "collRemoteHistoryContaos", ")", "{", "foreach", "(", "$", "this", "->", "collRemoteHistoryContaos", "as", "$", "o", ")", "{", "$", "o", "->", "clearAllReferences", "(", "$", "deep", ")", ";", "}", "}", "if", "(", "$", "this", "->", "aCustomer", "instanceof", "Persistent", ")", "{", "$", "this", "->", "aCustomer", "->", "clearAllReferences", "(", "$", "deep", ")", ";", "}", "$", "this", "->", "alreadyInClearAllReferencesDeep", "=", "false", ";", "}", "// if ($deep)", "if", "(", "$", "this", "->", "collApiLogs", "instanceof", "PropelCollection", ")", "{", "$", "this", "->", "collApiLogs", "->", "clearIterator", "(", ")", ";", "}", "$", "this", "->", "collApiLogs", "=", "null", ";", "if", "(", "$", "this", "->", "collRemoteHistoryContaos", "instanceof", "PropelCollection", ")", "{", "$", "this", "->", "collRemoteHistoryContaos", "->", "clearIterator", "(", ")", ";", "}", "$", "this", "->", "collRemoteHistoryContaos", "=", "null", ";", "$", "this", "->", "aCustomer", "=", "null", ";", "}" ]
Resets all references to other model objects or collections of model objects. This method is a user-space workaround for PHP's inability to garbage collect objects with circular references (even in PHP 5.3). This is currently necessary when using Propel in certain daemon or large-volume/high-memory operations. @param boolean $deep Whether to also clear the references on all referrer objects.
[ "Resets", "all", "references", "to", "other", "model", "objects", "or", "collections", "of", "model", "objects", "." ]
train
https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteApp.php#L2910-L2940
drsdre/yii2-xmlsoccer
commands/XmlSoccerController.php
XmlSoccerController.actionImportLeagues
public function actionImportLeagues() { $client = new Client([ 'apiKey' => $this->apiKey ]); $leagues = $client->getAllLeagues(); $count = 0; foreach ($leagues as $league) { $dbLeague = Yii::createObject([ 'class' => $this->leagueClass, 'interface_id' => ArrayHelper::getValue($league, 'Id'), 'name' => ArrayHelper::getValue($league, 'Name'), 'country' => ArrayHelper::getValue($league, 'Country'), 'historical_data' => constant( '\drsdre\yii\xmlsoccer\models\League::HISTORICAL_DATA_' . strtoupper(ArrayHelper::getValue($league, 'Historical_Data', 'no')) ), 'fixtures' => filter_var( strtolower(ArrayHelper::getValue($league, 'Fixtures', 'no')), FILTER_VALIDATE_BOOLEAN ), 'livescore' => filter_var( strtolower(ArrayHelper::getValue($league, 'Livescore', 'no')), FILTER_VALIDATE_BOOLEAN ), 'number_of_matches' => ArrayHelper::getValue($league, 'NumberOfMatches', 0), 'latest_match' => ArrayHelper::getValue($league, 'LatestMatch'), 'is_cup' => filter_var( strtolower(ArrayHelper::getValue($league, 'IsCup', 'no')), FILTER_VALIDATE_BOOLEAN ) ]); /* @var $dbLeague \drsdre\yii\xmlsoccer\models\League */ if (!$dbLeague->save()) { $this->stderr("Failed to import league '{$dbLeague->name}': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbLeague->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); } else { $count++; $this->stdout("League '{$dbLeague->name}' inserted\n"); } } $this->stdout("\n"); $this->stdout("$count leagues imported", Console::FG_GREEN); $this->stdout("\n"); return ExitCode::OK; }
php
public function actionImportLeagues() { $client = new Client([ 'apiKey' => $this->apiKey ]); $leagues = $client->getAllLeagues(); $count = 0; foreach ($leagues as $league) { $dbLeague = Yii::createObject([ 'class' => $this->leagueClass, 'interface_id' => ArrayHelper::getValue($league, 'Id'), 'name' => ArrayHelper::getValue($league, 'Name'), 'country' => ArrayHelper::getValue($league, 'Country'), 'historical_data' => constant( '\drsdre\yii\xmlsoccer\models\League::HISTORICAL_DATA_' . strtoupper(ArrayHelper::getValue($league, 'Historical_Data', 'no')) ), 'fixtures' => filter_var( strtolower(ArrayHelper::getValue($league, 'Fixtures', 'no')), FILTER_VALIDATE_BOOLEAN ), 'livescore' => filter_var( strtolower(ArrayHelper::getValue($league, 'Livescore', 'no')), FILTER_VALIDATE_BOOLEAN ), 'number_of_matches' => ArrayHelper::getValue($league, 'NumberOfMatches', 0), 'latest_match' => ArrayHelper::getValue($league, 'LatestMatch'), 'is_cup' => filter_var( strtolower(ArrayHelper::getValue($league, 'IsCup', 'no')), FILTER_VALIDATE_BOOLEAN ) ]); /* @var $dbLeague \drsdre\yii\xmlsoccer\models\League */ if (!$dbLeague->save()) { $this->stderr("Failed to import league '{$dbLeague->name}': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbLeague->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); } else { $count++; $this->stdout("League '{$dbLeague->name}' inserted\n"); } } $this->stdout("\n"); $this->stdout("$count leagues imported", Console::FG_GREEN); $this->stdout("\n"); return ExitCode::OK; }
[ "public", "function", "actionImportLeagues", "(", ")", "{", "$", "client", "=", "new", "Client", "(", "[", "'apiKey'", "=>", "$", "this", "->", "apiKey", "]", ")", ";", "$", "leagues", "=", "$", "client", "->", "getAllLeagues", "(", ")", ";", "$", "count", "=", "0", ";", "foreach", "(", "$", "leagues", "as", "$", "league", ")", "{", "$", "dbLeague", "=", "Yii", "::", "createObject", "(", "[", "'class'", "=>", "$", "this", "->", "leagueClass", ",", "'interface_id'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "league", ",", "'Id'", ")", ",", "'name'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "league", ",", "'Name'", ")", ",", "'country'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "league", ",", "'Country'", ")", ",", "'historical_data'", "=>", "constant", "(", "'\\drsdre\\yii\\xmlsoccer\\models\\League::HISTORICAL_DATA_'", ".", "strtoupper", "(", "ArrayHelper", "::", "getValue", "(", "$", "league", ",", "'Historical_Data'", ",", "'no'", ")", ")", ")", ",", "'fixtures'", "=>", "filter_var", "(", "strtolower", "(", "ArrayHelper", "::", "getValue", "(", "$", "league", ",", "'Fixtures'", ",", "'no'", ")", ")", ",", "FILTER_VALIDATE_BOOLEAN", ")", ",", "'livescore'", "=>", "filter_var", "(", "strtolower", "(", "ArrayHelper", "::", "getValue", "(", "$", "league", ",", "'Livescore'", ",", "'no'", ")", ")", ",", "FILTER_VALIDATE_BOOLEAN", ")", ",", "'number_of_matches'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "league", ",", "'NumberOfMatches'", ",", "0", ")", ",", "'latest_match'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "league", ",", "'LatestMatch'", ")", ",", "'is_cup'", "=>", "filter_var", "(", "strtolower", "(", "ArrayHelper", "::", "getValue", "(", "$", "league", ",", "'IsCup'", ",", "'no'", ")", ")", ",", "FILTER_VALIDATE_BOOLEAN", ")", "]", ")", ";", "/* @var $dbLeague \\drsdre\\yii\\xmlsoccer\\models\\League */", "if", "(", "!", "$", "dbLeague", "->", "save", "(", ")", ")", "{", "$", "this", "->", "stderr", "(", "\"Failed to import league '{$dbLeague->name}': \"", ",", "Console", "::", "FG_RED", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "foreach", "(", "$", "dbLeague", "->", "errors", "as", "$", "attribute", "=>", "$", "errors", ")", "{", "foreach", "(", "$", "errors", "as", "$", "error", ")", "{", "$", "this", "->", "stderr", "(", "\"$attribute: $error\"", ",", "Console", "::", "BG_YELLOW", ",", "Console", "::", "FG_BLACK", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "}", "}", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "}", "else", "{", "$", "count", "++", ";", "$", "this", "->", "stdout", "(", "\"League '{$dbLeague->name}' inserted\\n\"", ")", ";", "}", "}", "$", "this", "->", "stdout", "(", "\"\\n\"", ")", ";", "$", "this", "->", "stdout", "(", "\"$count leagues imported\"", ",", "Console", "::", "FG_GREEN", ")", ";", "$", "this", "->", "stdout", "(", "\"\\n\"", ")", ";", "return", "ExitCode", "::", "OK", ";", "}" ]
Import all leagues from XMLSoccer interface @return integer Exit code @throws \yii\base\InvalidConfigException
[ "Import", "all", "leagues", "from", "XMLSoccer", "interface" ]
train
https://github.com/drsdre/yii2-xmlsoccer/blob/a746edee6269ed0791bac6c6165a946adc30d994/commands/XmlSoccerController.php#L82-L138
drsdre/yii2-xmlsoccer
commands/XmlSoccerController.php
XmlSoccerController.actionShowLeagues
public function actionShowLeagues() { $leagues = call_user_func([$this->leagueClass, 'find']); /* @var $leagues \yii\db\ActiveQuery */ if (!$leagues->count('id')) { $this->stdout("No leagues found. Import by "); $this->stdout("{$this->id}/import-leagues", Console::BOLD); $this->stdout("\n"); return ExitCode::OK; } $first = $leagues->one(); $headers = []; $rows = []; $attributes = []; foreach ($first->toArray() as $attribute => $value) { $attributes[] = $attribute; $headers[] = $first->generateAttributeLabel($attribute); } foreach ($leagues->all() as $league) { $rows[] = array_values($league->toArray($attributes)); } echo Table::widget([ 'headers' => $headers, 'rows' => $rows ]); return ExitCode::OK; }
php
public function actionShowLeagues() { $leagues = call_user_func([$this->leagueClass, 'find']); /* @var $leagues \yii\db\ActiveQuery */ if (!$leagues->count('id')) { $this->stdout("No leagues found. Import by "); $this->stdout("{$this->id}/import-leagues", Console::BOLD); $this->stdout("\n"); return ExitCode::OK; } $first = $leagues->one(); $headers = []; $rows = []; $attributes = []; foreach ($first->toArray() as $attribute => $value) { $attributes[] = $attribute; $headers[] = $first->generateAttributeLabel($attribute); } foreach ($leagues->all() as $league) { $rows[] = array_values($league->toArray($attributes)); } echo Table::widget([ 'headers' => $headers, 'rows' => $rows ]); return ExitCode::OK; }
[ "public", "function", "actionShowLeagues", "(", ")", "{", "$", "leagues", "=", "call_user_func", "(", "[", "$", "this", "->", "leagueClass", ",", "'find'", "]", ")", ";", "/* @var $leagues \\yii\\db\\ActiveQuery */", "if", "(", "!", "$", "leagues", "->", "count", "(", "'id'", ")", ")", "{", "$", "this", "->", "stdout", "(", "\"No leagues found. Import by \"", ")", ";", "$", "this", "->", "stdout", "(", "\"{$this->id}/import-leagues\"", ",", "Console", "::", "BOLD", ")", ";", "$", "this", "->", "stdout", "(", "\"\\n\"", ")", ";", "return", "ExitCode", "::", "OK", ";", "}", "$", "first", "=", "$", "leagues", "->", "one", "(", ")", ";", "$", "headers", "=", "[", "]", ";", "$", "rows", "=", "[", "]", ";", "$", "attributes", "=", "[", "]", ";", "foreach", "(", "$", "first", "->", "toArray", "(", ")", "as", "$", "attribute", "=>", "$", "value", ")", "{", "$", "attributes", "[", "]", "=", "$", "attribute", ";", "$", "headers", "[", "]", "=", "$", "first", "->", "generateAttributeLabel", "(", "$", "attribute", ")", ";", "}", "foreach", "(", "$", "leagues", "->", "all", "(", ")", "as", "$", "league", ")", "{", "$", "rows", "[", "]", "=", "array_values", "(", "$", "league", "->", "toArray", "(", "$", "attributes", ")", ")", ";", "}", "echo", "Table", "::", "widget", "(", "[", "'headers'", "=>", "$", "headers", ",", "'rows'", "=>", "$", "rows", "]", ")", ";", "return", "ExitCode", "::", "OK", ";", "}" ]
Show all leagues @return integer Exit code @throws \Exception
[ "Show", "all", "leagues" ]
train
https://github.com/drsdre/yii2-xmlsoccer/blob/a746edee6269ed0791bac6c6165a946adc30d994/commands/XmlSoccerController.php#L146-L177
drsdre/yii2-xmlsoccer
commands/XmlSoccerController.php
XmlSoccerController.actionCreateLeague
public function actionCreateLeague($league_id, $seasonDateString = null) { $league = call_user_func([$this->leagueClass, 'findOne'], $league_id); /* @var $league \drsdre\yii\xmlsoccer\models\League */ if (empty($seasonDateString)) { $year = intval(date('y')); $seasonDateString = sprintf('%02s%02s', $year - 1, $year); } if (!$league) { $this->stderr("League with id '$league_id' not found", Console::FG_RED); $this->stderr("\n"); return ExitCode::DATAERR; } $client = new Client([ 'apiKey' => $this->apiKey ]); $teams = $client->getAllTeamsByLeagueAndSeason($league->interface_id, $seasonDateString); $matches = $client->getFixturesByLeagueAndSeason($league->interface_id, $seasonDateString); if ($league->is_cup) { $groups = $client->getAllGroupsByLeagueAndSeason($league->interface_id, $seasonDateString); foreach ($groups as $group) { $dbGroup = Yii::createObject([ 'class' => $this->groupClass, 'interface_id' => ArrayHelper::getValue($group, 'Id'), 'name' => ArrayHelper::getValue($group, 'Name'), 'season' => ArrayHelper::getValue($group, 'Season'), 'league_id' => $league->id, 'is_knockout_stage' => (false !== strpos( strtolower(ArrayHelper::getValue($group, 'Name')), 'finals') ) ]); /* @var $dbGroup \drsdre\yii\xmlsoccer\models\Group */ if (!$dbGroup->save()) { $this->stderr("Failed to save group '{$dbGroup->name}': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbGroup->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); return ExitCode::IOERR; } else { $this->stdout("Group '{$dbGroup->name}' saved", Console::FG_GREEN); $this->stdout("\n"); } } } $players = []; foreach ($teams as $team) { $dbTeam = Yii::createObject([ 'class' => $this->teamClass, 'interface_id' => ArrayHelper::getValue($team, 'Team_Id'), 'name' => ArrayHelper::getValue($team, 'Name'), 'country' => ArrayHelper::getValue($team, 'Country'), 'stadium' => (($tmp = ArrayHelper::getValue($team, 'Stadium')) && !empty($tmp)) ? $tmp : null, 'home_page_url' => (($tmp = ArrayHelper::getValue($team, 'HomePageURL')) && !empty($tmp)) ? $tmp : null, 'wiki_link' => (($tmp = ArrayHelper::getValue($team, 'WIKILink')) && !empty($tmp)) ? $tmp : null, 'coach' => ArrayHelper::getValue($team, 'Coach') ?: ArrayHelper::getValue($team, 'Manager') ]); /* @var $dbTeam \drsdre\yii\xmlsoccer\models\Team */ if (!$dbTeam->save()) { $this->stderr("Failed to save team '{$dbTeam->name}': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbTeam->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); return ExitCode::IOERR; } else { $this->stdout("Team '{$dbTeam->name}' saved", Console::FG_GREEN); $this->stdout("\n"); $teamPlayers = $client->getPlayersByTeam(ArrayHelper::getValue($team, 'Team_Id')); if (ArrayHelper::isAssociative($teamPlayers) && ArrayHelper::keyExists('Name', $teamPlayers)) { $teamPlayers = [$teamPlayers]; } $players = array_merge($players, $teamPlayers); } } $groups = call_user_func([ $this->groupClass, 'find' ])->where(['league_id' => $league->id])->indexBy('interface_id')->all(); $teams = call_user_func([$this->teamClass, 'find'])->indexBy('interface_id')->all(); /* @var $groups \drsdre\yii\xmlsoccer\models\Group[] */ /* @var $teams \drsdre\yii\xmlsoccer\models\Team[] */ foreach ($players as $player) { $dbPlayer = Yii::createObject([ 'class' => $this->playerClass, 'interface_id' => ArrayHelper::getValue($player, 'Id'), 'name' => ArrayHelper::getValue($player, 'Name'), 'nationality' => (($tmp = ArrayHelper::getValue($player, 'Nationality')) && !empty($tmp)) ? $tmp : null, 'position' => (($tmp = ArrayHelper::getValue($player, 'Position')) && !empty($tmp)) ? $tmp : null, 'team_id' => ArrayHelper::getValue($teams, [ArrayHelper::getValue($player, 'Team_Id'), 'id']), 'loan_to' => ArrayHelper::getValue($teams, [ArrayHelper::getValue($player, 'LoanTo'), 'id']), 'player_number' => intval(ArrayHelper::getValue($player, 'PlayerNumber')), 'date_of_birth' => ArrayHelper::getValue($player, 'DateOfBirth'), 'date_of_signing' => ArrayHelper::getValue($player, 'DateOfSigning'), 'signing' => html_entity_decode( (string)(($tmp = ArrayHelper::getValue($player, 'Signing')) && !empty($tmp)) ? $tmp : null, ENT_COMPAT | ENT_HTML5, 'utf-8' ) ]); /* @var $dbPlayer \drsdre\yii\xmlsoccer\models\Player */ if (!$dbPlayer->save()) { $this->stderr("Failed to save player '{$dbPlayer->name}': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbPlayer->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); return ExitCode::IOERR; } else { $this->stdout("Player '{$dbPlayer->name}' saved", Console::FG_GREEN); $this->stdout("\n"); } } foreach ($matches as $match) { $homeTeam = ArrayHelper::getValue($teams, ArrayHelper::getValue($match, 'HomeTeam_Id')); $awayTeam = ArrayHelper::getValue($teams, ArrayHelper::getValue($match, 'AwayTeam_Id')); /* @var $homeTeam \drsdre\yii\xmlsoccer\models\Team */ /* @var $awayTeam \drsdre\yii\xmlsoccer\models\Team */ $dbMatch = Yii::createObject([ 'class' => $this->matchClass, 'interface_id' => ArrayHelper::getValue($match, 'Id'), 'date' => ArrayHelper::getValue($match, 'Date'), 'league_id' => $league->id, 'round' => ArrayHelper::getValue($match, 'Round'), 'home_team_id' => $homeTeam->id, 'away_team_id' => $awayTeam->id, 'group_id' => ArrayHelper::getValue($groups, [ArrayHelper::getValue($match, 'Group_Id'), 'id']), 'location' => (($tmp = ArrayHelper::getValue($match, 'Location')) && !empty($tmp)) ? $tmp : null ]); /* @var $dbMatch \drsdre\yii\xmlsoccer\models\Match */ if (!$dbMatch->save()) { $this->stderr("Failed to save match '{$dbMatch->location}-{$dbMatch->date}': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbMatch->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); return ExitCode::IOERR; } else { $this->stdout("Match '{$dbMatch->location}-{$dbMatch->date}' saved", Console::FG_GREEN); $this->stdout("\n"); if (ArrayHelper::keyExists('HomeGoalDetails', $match)) { $homeGoals = is_string($tmp = ArrayHelper::getValue($match, 'HomeGoalDetails', '')) ? explode(';', $tmp) : $tmp; $homePlayers = $homeTeam->getPlayers()->indexBy('name')->all(); $awayGoals = is_string($tmp = ArrayHelper::getValue($match, 'AwayGoalDetails', '')) ? explode(';', $tmp) : $tmp; $awayPlayers = $awayTeam->getPlayers()->indexBy('name')->all(); foreach ($homeGoals as $homeGoal) { @list($minute, $player) = @array_map('trim', @explode(':', $homeGoal)); $isPenalty = substr($player, 0, 7) === 'penalty'; if ($isPenalty) { $player = ltrim(substr($player, 8)); } $isOwn = substr($player, 0, 3) === 'Own'; if ($isOwn) { $player = ltrim(substr($player, 4)); } $minute = rtrim($minute, '\''); $dbGoal = Yii::createObject([ 'class' => $this->goalClass, 'match_id' => $dbMatch->id, 'minute' => $minute, 'team_id' => $homeTeam->id, 'player_id' => ArrayHelper::getValue( ($isOwn ? $awayPlayers : $homePlayers), [$player, 'id'] ), 'owngoal' => $isOwn, 'penalty' => $isPenalty ]); /* @var $dbGoal \drsdre\yii\xmlsoccer\models\Goal */ if (!$dbGoal->save()) { $this->stderr("Failed to save goal '$minute': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbGoal->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); } else { $this->stdout("Goal '$minute' saved", Console::FG_GREEN); $this->stdout("\n"); } } foreach ($awayGoals as $awayGoal) { @list($minute, $player) = @array_map('trim', @explode(':', $awayGoal)); $isPenalty = substr($player, 0, 7) === 'penalty'; if ($isPenalty) { $player = ltrim(substr($player, 8)); } $isOwn = substr($player, 0, 3) === 'Own'; if ($isOwn) { $player = ltrim(substr($player, 4)); } $minute = rtrim($minute, '\''); $dbGoal = Yii::createObject([ 'class' => $this->goalClass, 'match_id' => $dbMatch->id, 'minute' => $minute, 'team_id' => $awayTeam->id, 'player_id' => ArrayHelper::getValue( ($isOwn ? $homePlayers : $awayPlayers), [$player, 'id'] ), 'owngoal' => $isOwn, 'penalty' => $isPenalty ]); /* @var $dbGoal \drsdre\yii\xmlsoccer\models\Goal */ if (!$dbGoal->save()) { $this->stderr("Failed to save goal '$minute': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbGoal->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); } else { $this->stdout("Goal '$minute' saved", Console::FG_GREEN); $this->stdout("\n"); } } } } } return ExitCode::OK; }
php
public function actionCreateLeague($league_id, $seasonDateString = null) { $league = call_user_func([$this->leagueClass, 'findOne'], $league_id); /* @var $league \drsdre\yii\xmlsoccer\models\League */ if (empty($seasonDateString)) { $year = intval(date('y')); $seasonDateString = sprintf('%02s%02s', $year - 1, $year); } if (!$league) { $this->stderr("League with id '$league_id' not found", Console::FG_RED); $this->stderr("\n"); return ExitCode::DATAERR; } $client = new Client([ 'apiKey' => $this->apiKey ]); $teams = $client->getAllTeamsByLeagueAndSeason($league->interface_id, $seasonDateString); $matches = $client->getFixturesByLeagueAndSeason($league->interface_id, $seasonDateString); if ($league->is_cup) { $groups = $client->getAllGroupsByLeagueAndSeason($league->interface_id, $seasonDateString); foreach ($groups as $group) { $dbGroup = Yii::createObject([ 'class' => $this->groupClass, 'interface_id' => ArrayHelper::getValue($group, 'Id'), 'name' => ArrayHelper::getValue($group, 'Name'), 'season' => ArrayHelper::getValue($group, 'Season'), 'league_id' => $league->id, 'is_knockout_stage' => (false !== strpos( strtolower(ArrayHelper::getValue($group, 'Name')), 'finals') ) ]); /* @var $dbGroup \drsdre\yii\xmlsoccer\models\Group */ if (!$dbGroup->save()) { $this->stderr("Failed to save group '{$dbGroup->name}': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbGroup->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); return ExitCode::IOERR; } else { $this->stdout("Group '{$dbGroup->name}' saved", Console::FG_GREEN); $this->stdout("\n"); } } } $players = []; foreach ($teams as $team) { $dbTeam = Yii::createObject([ 'class' => $this->teamClass, 'interface_id' => ArrayHelper::getValue($team, 'Team_Id'), 'name' => ArrayHelper::getValue($team, 'Name'), 'country' => ArrayHelper::getValue($team, 'Country'), 'stadium' => (($tmp = ArrayHelper::getValue($team, 'Stadium')) && !empty($tmp)) ? $tmp : null, 'home_page_url' => (($tmp = ArrayHelper::getValue($team, 'HomePageURL')) && !empty($tmp)) ? $tmp : null, 'wiki_link' => (($tmp = ArrayHelper::getValue($team, 'WIKILink')) && !empty($tmp)) ? $tmp : null, 'coach' => ArrayHelper::getValue($team, 'Coach') ?: ArrayHelper::getValue($team, 'Manager') ]); /* @var $dbTeam \drsdre\yii\xmlsoccer\models\Team */ if (!$dbTeam->save()) { $this->stderr("Failed to save team '{$dbTeam->name}': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbTeam->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); return ExitCode::IOERR; } else { $this->stdout("Team '{$dbTeam->name}' saved", Console::FG_GREEN); $this->stdout("\n"); $teamPlayers = $client->getPlayersByTeam(ArrayHelper::getValue($team, 'Team_Id')); if (ArrayHelper::isAssociative($teamPlayers) && ArrayHelper::keyExists('Name', $teamPlayers)) { $teamPlayers = [$teamPlayers]; } $players = array_merge($players, $teamPlayers); } } $groups = call_user_func([ $this->groupClass, 'find' ])->where(['league_id' => $league->id])->indexBy('interface_id')->all(); $teams = call_user_func([$this->teamClass, 'find'])->indexBy('interface_id')->all(); /* @var $groups \drsdre\yii\xmlsoccer\models\Group[] */ /* @var $teams \drsdre\yii\xmlsoccer\models\Team[] */ foreach ($players as $player) { $dbPlayer = Yii::createObject([ 'class' => $this->playerClass, 'interface_id' => ArrayHelper::getValue($player, 'Id'), 'name' => ArrayHelper::getValue($player, 'Name'), 'nationality' => (($tmp = ArrayHelper::getValue($player, 'Nationality')) && !empty($tmp)) ? $tmp : null, 'position' => (($tmp = ArrayHelper::getValue($player, 'Position')) && !empty($tmp)) ? $tmp : null, 'team_id' => ArrayHelper::getValue($teams, [ArrayHelper::getValue($player, 'Team_Id'), 'id']), 'loan_to' => ArrayHelper::getValue($teams, [ArrayHelper::getValue($player, 'LoanTo'), 'id']), 'player_number' => intval(ArrayHelper::getValue($player, 'PlayerNumber')), 'date_of_birth' => ArrayHelper::getValue($player, 'DateOfBirth'), 'date_of_signing' => ArrayHelper::getValue($player, 'DateOfSigning'), 'signing' => html_entity_decode( (string)(($tmp = ArrayHelper::getValue($player, 'Signing')) && !empty($tmp)) ? $tmp : null, ENT_COMPAT | ENT_HTML5, 'utf-8' ) ]); /* @var $dbPlayer \drsdre\yii\xmlsoccer\models\Player */ if (!$dbPlayer->save()) { $this->stderr("Failed to save player '{$dbPlayer->name}': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbPlayer->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); return ExitCode::IOERR; } else { $this->stdout("Player '{$dbPlayer->name}' saved", Console::FG_GREEN); $this->stdout("\n"); } } foreach ($matches as $match) { $homeTeam = ArrayHelper::getValue($teams, ArrayHelper::getValue($match, 'HomeTeam_Id')); $awayTeam = ArrayHelper::getValue($teams, ArrayHelper::getValue($match, 'AwayTeam_Id')); /* @var $homeTeam \drsdre\yii\xmlsoccer\models\Team */ /* @var $awayTeam \drsdre\yii\xmlsoccer\models\Team */ $dbMatch = Yii::createObject([ 'class' => $this->matchClass, 'interface_id' => ArrayHelper::getValue($match, 'Id'), 'date' => ArrayHelper::getValue($match, 'Date'), 'league_id' => $league->id, 'round' => ArrayHelper::getValue($match, 'Round'), 'home_team_id' => $homeTeam->id, 'away_team_id' => $awayTeam->id, 'group_id' => ArrayHelper::getValue($groups, [ArrayHelper::getValue($match, 'Group_Id'), 'id']), 'location' => (($tmp = ArrayHelper::getValue($match, 'Location')) && !empty($tmp)) ? $tmp : null ]); /* @var $dbMatch \drsdre\yii\xmlsoccer\models\Match */ if (!$dbMatch->save()) { $this->stderr("Failed to save match '{$dbMatch->location}-{$dbMatch->date}': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbMatch->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); return ExitCode::IOERR; } else { $this->stdout("Match '{$dbMatch->location}-{$dbMatch->date}' saved", Console::FG_GREEN); $this->stdout("\n"); if (ArrayHelper::keyExists('HomeGoalDetails', $match)) { $homeGoals = is_string($tmp = ArrayHelper::getValue($match, 'HomeGoalDetails', '')) ? explode(';', $tmp) : $tmp; $homePlayers = $homeTeam->getPlayers()->indexBy('name')->all(); $awayGoals = is_string($tmp = ArrayHelper::getValue($match, 'AwayGoalDetails', '')) ? explode(';', $tmp) : $tmp; $awayPlayers = $awayTeam->getPlayers()->indexBy('name')->all(); foreach ($homeGoals as $homeGoal) { @list($minute, $player) = @array_map('trim', @explode(':', $homeGoal)); $isPenalty = substr($player, 0, 7) === 'penalty'; if ($isPenalty) { $player = ltrim(substr($player, 8)); } $isOwn = substr($player, 0, 3) === 'Own'; if ($isOwn) { $player = ltrim(substr($player, 4)); } $minute = rtrim($minute, '\''); $dbGoal = Yii::createObject([ 'class' => $this->goalClass, 'match_id' => $dbMatch->id, 'minute' => $minute, 'team_id' => $homeTeam->id, 'player_id' => ArrayHelper::getValue( ($isOwn ? $awayPlayers : $homePlayers), [$player, 'id'] ), 'owngoal' => $isOwn, 'penalty' => $isPenalty ]); /* @var $dbGoal \drsdre\yii\xmlsoccer\models\Goal */ if (!$dbGoal->save()) { $this->stderr("Failed to save goal '$minute': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbGoal->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); } else { $this->stdout("Goal '$minute' saved", Console::FG_GREEN); $this->stdout("\n"); } } foreach ($awayGoals as $awayGoal) { @list($minute, $player) = @array_map('trim', @explode(':', $awayGoal)); $isPenalty = substr($player, 0, 7) === 'penalty'; if ($isPenalty) { $player = ltrim(substr($player, 8)); } $isOwn = substr($player, 0, 3) === 'Own'; if ($isOwn) { $player = ltrim(substr($player, 4)); } $minute = rtrim($minute, '\''); $dbGoal = Yii::createObject([ 'class' => $this->goalClass, 'match_id' => $dbMatch->id, 'minute' => $minute, 'team_id' => $awayTeam->id, 'player_id' => ArrayHelper::getValue( ($isOwn ? $homePlayers : $awayPlayers), [$player, 'id'] ), 'owngoal' => $isOwn, 'penalty' => $isPenalty ]); /* @var $dbGoal \drsdre\yii\xmlsoccer\models\Goal */ if (!$dbGoal->save()) { $this->stderr("Failed to save goal '$minute': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbGoal->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); } else { $this->stdout("Goal '$minute' saved", Console::FG_GREEN); $this->stdout("\n"); } } } } } return ExitCode::OK; }
[ "public", "function", "actionCreateLeague", "(", "$", "league_id", ",", "$", "seasonDateString", "=", "null", ")", "{", "$", "league", "=", "call_user_func", "(", "[", "$", "this", "->", "leagueClass", ",", "'findOne'", "]", ",", "$", "league_id", ")", ";", "/* @var $league \\drsdre\\yii\\xmlsoccer\\models\\League */", "if", "(", "empty", "(", "$", "seasonDateString", ")", ")", "{", "$", "year", "=", "intval", "(", "date", "(", "'y'", ")", ")", ";", "$", "seasonDateString", "=", "sprintf", "(", "'%02s%02s'", ",", "$", "year", "-", "1", ",", "$", "year", ")", ";", "}", "if", "(", "!", "$", "league", ")", "{", "$", "this", "->", "stderr", "(", "\"League with id '$league_id' not found\"", ",", "Console", "::", "FG_RED", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "return", "ExitCode", "::", "DATAERR", ";", "}", "$", "client", "=", "new", "Client", "(", "[", "'apiKey'", "=>", "$", "this", "->", "apiKey", "]", ")", ";", "$", "teams", "=", "$", "client", "->", "getAllTeamsByLeagueAndSeason", "(", "$", "league", "->", "interface_id", ",", "$", "seasonDateString", ")", ";", "$", "matches", "=", "$", "client", "->", "getFixturesByLeagueAndSeason", "(", "$", "league", "->", "interface_id", ",", "$", "seasonDateString", ")", ";", "if", "(", "$", "league", "->", "is_cup", ")", "{", "$", "groups", "=", "$", "client", "->", "getAllGroupsByLeagueAndSeason", "(", "$", "league", "->", "interface_id", ",", "$", "seasonDateString", ")", ";", "foreach", "(", "$", "groups", "as", "$", "group", ")", "{", "$", "dbGroup", "=", "Yii", "::", "createObject", "(", "[", "'class'", "=>", "$", "this", "->", "groupClass", ",", "'interface_id'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "group", ",", "'Id'", ")", ",", "'name'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "group", ",", "'Name'", ")", ",", "'season'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "group", ",", "'Season'", ")", ",", "'league_id'", "=>", "$", "league", "->", "id", ",", "'is_knockout_stage'", "=>", "(", "false", "!==", "strpos", "(", "strtolower", "(", "ArrayHelper", "::", "getValue", "(", "$", "group", ",", "'Name'", ")", ")", ",", "'finals'", ")", ")", "]", ")", ";", "/* @var $dbGroup \\drsdre\\yii\\xmlsoccer\\models\\Group */", "if", "(", "!", "$", "dbGroup", "->", "save", "(", ")", ")", "{", "$", "this", "->", "stderr", "(", "\"Failed to save group '{$dbGroup->name}': \"", ",", "Console", "::", "FG_RED", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "foreach", "(", "$", "dbGroup", "->", "errors", "as", "$", "attribute", "=>", "$", "errors", ")", "{", "foreach", "(", "$", "errors", "as", "$", "error", ")", "{", "$", "this", "->", "stderr", "(", "\"$attribute: $error\"", ",", "Console", "::", "BG_YELLOW", ",", "Console", "::", "FG_BLACK", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "}", "}", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "return", "ExitCode", "::", "IOERR", ";", "}", "else", "{", "$", "this", "->", "stdout", "(", "\"Group '{$dbGroup->name}' saved\"", ",", "Console", "::", "FG_GREEN", ")", ";", "$", "this", "->", "stdout", "(", "\"\\n\"", ")", ";", "}", "}", "}", "$", "players", "=", "[", "]", ";", "foreach", "(", "$", "teams", "as", "$", "team", ")", "{", "$", "dbTeam", "=", "Yii", "::", "createObject", "(", "[", "'class'", "=>", "$", "this", "->", "teamClass", ",", "'interface_id'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "team", ",", "'Team_Id'", ")", ",", "'name'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "team", ",", "'Name'", ")", ",", "'country'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "team", ",", "'Country'", ")", ",", "'stadium'", "=>", "(", "(", "$", "tmp", "=", "ArrayHelper", "::", "getValue", "(", "$", "team", ",", "'Stadium'", ")", ")", "&&", "!", "empty", "(", "$", "tmp", ")", ")", "?", "$", "tmp", ":", "null", ",", "'home_page_url'", "=>", "(", "(", "$", "tmp", "=", "ArrayHelper", "::", "getValue", "(", "$", "team", ",", "'HomePageURL'", ")", ")", "&&", "!", "empty", "(", "$", "tmp", ")", ")", "?", "$", "tmp", ":", "null", ",", "'wiki_link'", "=>", "(", "(", "$", "tmp", "=", "ArrayHelper", "::", "getValue", "(", "$", "team", ",", "'WIKILink'", ")", ")", "&&", "!", "empty", "(", "$", "tmp", ")", ")", "?", "$", "tmp", ":", "null", ",", "'coach'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "team", ",", "'Coach'", ")", "?", ":", "ArrayHelper", "::", "getValue", "(", "$", "team", ",", "'Manager'", ")", "]", ")", ";", "/* @var $dbTeam \\drsdre\\yii\\xmlsoccer\\models\\Team */", "if", "(", "!", "$", "dbTeam", "->", "save", "(", ")", ")", "{", "$", "this", "->", "stderr", "(", "\"Failed to save team '{$dbTeam->name}': \"", ",", "Console", "::", "FG_RED", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "foreach", "(", "$", "dbTeam", "->", "errors", "as", "$", "attribute", "=>", "$", "errors", ")", "{", "foreach", "(", "$", "errors", "as", "$", "error", ")", "{", "$", "this", "->", "stderr", "(", "\"$attribute: $error\"", ",", "Console", "::", "BG_YELLOW", ",", "Console", "::", "FG_BLACK", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "}", "}", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "return", "ExitCode", "::", "IOERR", ";", "}", "else", "{", "$", "this", "->", "stdout", "(", "\"Team '{$dbTeam->name}' saved\"", ",", "Console", "::", "FG_GREEN", ")", ";", "$", "this", "->", "stdout", "(", "\"\\n\"", ")", ";", "$", "teamPlayers", "=", "$", "client", "->", "getPlayersByTeam", "(", "ArrayHelper", "::", "getValue", "(", "$", "team", ",", "'Team_Id'", ")", ")", ";", "if", "(", "ArrayHelper", "::", "isAssociative", "(", "$", "teamPlayers", ")", "&&", "ArrayHelper", "::", "keyExists", "(", "'Name'", ",", "$", "teamPlayers", ")", ")", "{", "$", "teamPlayers", "=", "[", "$", "teamPlayers", "]", ";", "}", "$", "players", "=", "array_merge", "(", "$", "players", ",", "$", "teamPlayers", ")", ";", "}", "}", "$", "groups", "=", "call_user_func", "(", "[", "$", "this", "->", "groupClass", ",", "'find'", "]", ")", "->", "where", "(", "[", "'league_id'", "=>", "$", "league", "->", "id", "]", ")", "->", "indexBy", "(", "'interface_id'", ")", "->", "all", "(", ")", ";", "$", "teams", "=", "call_user_func", "(", "[", "$", "this", "->", "teamClass", ",", "'find'", "]", ")", "->", "indexBy", "(", "'interface_id'", ")", "->", "all", "(", ")", ";", "/* @var $groups \\drsdre\\yii\\xmlsoccer\\models\\Group[] */", "/* @var $teams \\drsdre\\yii\\xmlsoccer\\models\\Team[] */", "foreach", "(", "$", "players", "as", "$", "player", ")", "{", "$", "dbPlayer", "=", "Yii", "::", "createObject", "(", "[", "'class'", "=>", "$", "this", "->", "playerClass", ",", "'interface_id'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "player", ",", "'Id'", ")", ",", "'name'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "player", ",", "'Name'", ")", ",", "'nationality'", "=>", "(", "(", "$", "tmp", "=", "ArrayHelper", "::", "getValue", "(", "$", "player", ",", "'Nationality'", ")", ")", "&&", "!", "empty", "(", "$", "tmp", ")", ")", "?", "$", "tmp", ":", "null", ",", "'position'", "=>", "(", "(", "$", "tmp", "=", "ArrayHelper", "::", "getValue", "(", "$", "player", ",", "'Position'", ")", ")", "&&", "!", "empty", "(", "$", "tmp", ")", ")", "?", "$", "tmp", ":", "null", ",", "'team_id'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "teams", ",", "[", "ArrayHelper", "::", "getValue", "(", "$", "player", ",", "'Team_Id'", ")", ",", "'id'", "]", ")", ",", "'loan_to'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "teams", ",", "[", "ArrayHelper", "::", "getValue", "(", "$", "player", ",", "'LoanTo'", ")", ",", "'id'", "]", ")", ",", "'player_number'", "=>", "intval", "(", "ArrayHelper", "::", "getValue", "(", "$", "player", ",", "'PlayerNumber'", ")", ")", ",", "'date_of_birth'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "player", ",", "'DateOfBirth'", ")", ",", "'date_of_signing'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "player", ",", "'DateOfSigning'", ")", ",", "'signing'", "=>", "html_entity_decode", "(", "(", "string", ")", "(", "(", "$", "tmp", "=", "ArrayHelper", "::", "getValue", "(", "$", "player", ",", "'Signing'", ")", ")", "&&", "!", "empty", "(", "$", "tmp", ")", ")", "?", "$", "tmp", ":", "null", ",", "ENT_COMPAT", "|", "ENT_HTML5", ",", "'utf-8'", ")", "]", ")", ";", "/* @var $dbPlayer \\drsdre\\yii\\xmlsoccer\\models\\Player */", "if", "(", "!", "$", "dbPlayer", "->", "save", "(", ")", ")", "{", "$", "this", "->", "stderr", "(", "\"Failed to save player '{$dbPlayer->name}': \"", ",", "Console", "::", "FG_RED", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "foreach", "(", "$", "dbPlayer", "->", "errors", "as", "$", "attribute", "=>", "$", "errors", ")", "{", "foreach", "(", "$", "errors", "as", "$", "error", ")", "{", "$", "this", "->", "stderr", "(", "\"$attribute: $error\"", ",", "Console", "::", "BG_YELLOW", ",", "Console", "::", "FG_BLACK", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "}", "}", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "return", "ExitCode", "::", "IOERR", ";", "}", "else", "{", "$", "this", "->", "stdout", "(", "\"Player '{$dbPlayer->name}' saved\"", ",", "Console", "::", "FG_GREEN", ")", ";", "$", "this", "->", "stdout", "(", "\"\\n\"", ")", ";", "}", "}", "foreach", "(", "$", "matches", "as", "$", "match", ")", "{", "$", "homeTeam", "=", "ArrayHelper", "::", "getValue", "(", "$", "teams", ",", "ArrayHelper", "::", "getValue", "(", "$", "match", ",", "'HomeTeam_Id'", ")", ")", ";", "$", "awayTeam", "=", "ArrayHelper", "::", "getValue", "(", "$", "teams", ",", "ArrayHelper", "::", "getValue", "(", "$", "match", ",", "'AwayTeam_Id'", ")", ")", ";", "/* @var $homeTeam \\drsdre\\yii\\xmlsoccer\\models\\Team */", "/* @var $awayTeam \\drsdre\\yii\\xmlsoccer\\models\\Team */", "$", "dbMatch", "=", "Yii", "::", "createObject", "(", "[", "'class'", "=>", "$", "this", "->", "matchClass", ",", "'interface_id'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "match", ",", "'Id'", ")", ",", "'date'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "match", ",", "'Date'", ")", ",", "'league_id'", "=>", "$", "league", "->", "id", ",", "'round'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "match", ",", "'Round'", ")", ",", "'home_team_id'", "=>", "$", "homeTeam", "->", "id", ",", "'away_team_id'", "=>", "$", "awayTeam", "->", "id", ",", "'group_id'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "groups", ",", "[", "ArrayHelper", "::", "getValue", "(", "$", "match", ",", "'Group_Id'", ")", ",", "'id'", "]", ")", ",", "'location'", "=>", "(", "(", "$", "tmp", "=", "ArrayHelper", "::", "getValue", "(", "$", "match", ",", "'Location'", ")", ")", "&&", "!", "empty", "(", "$", "tmp", ")", ")", "?", "$", "tmp", ":", "null", "]", ")", ";", "/* @var $dbMatch \\drsdre\\yii\\xmlsoccer\\models\\Match */", "if", "(", "!", "$", "dbMatch", "->", "save", "(", ")", ")", "{", "$", "this", "->", "stderr", "(", "\"Failed to save match '{$dbMatch->location}-{$dbMatch->date}': \"", ",", "Console", "::", "FG_RED", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "foreach", "(", "$", "dbMatch", "->", "errors", "as", "$", "attribute", "=>", "$", "errors", ")", "{", "foreach", "(", "$", "errors", "as", "$", "error", ")", "{", "$", "this", "->", "stderr", "(", "\"$attribute: $error\"", ",", "Console", "::", "BG_YELLOW", ",", "Console", "::", "FG_BLACK", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "}", "}", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "return", "ExitCode", "::", "IOERR", ";", "}", "else", "{", "$", "this", "->", "stdout", "(", "\"Match '{$dbMatch->location}-{$dbMatch->date}' saved\"", ",", "Console", "::", "FG_GREEN", ")", ";", "$", "this", "->", "stdout", "(", "\"\\n\"", ")", ";", "if", "(", "ArrayHelper", "::", "keyExists", "(", "'HomeGoalDetails'", ",", "$", "match", ")", ")", "{", "$", "homeGoals", "=", "is_string", "(", "$", "tmp", "=", "ArrayHelper", "::", "getValue", "(", "$", "match", ",", "'HomeGoalDetails'", ",", "''", ")", ")", "?", "explode", "(", "';'", ",", "$", "tmp", ")", ":", "$", "tmp", ";", "$", "homePlayers", "=", "$", "homeTeam", "->", "getPlayers", "(", ")", "->", "indexBy", "(", "'name'", ")", "->", "all", "(", ")", ";", "$", "awayGoals", "=", "is_string", "(", "$", "tmp", "=", "ArrayHelper", "::", "getValue", "(", "$", "match", ",", "'AwayGoalDetails'", ",", "''", ")", ")", "?", "explode", "(", "';'", ",", "$", "tmp", ")", ":", "$", "tmp", ";", "$", "awayPlayers", "=", "$", "awayTeam", "->", "getPlayers", "(", ")", "->", "indexBy", "(", "'name'", ")", "->", "all", "(", ")", ";", "foreach", "(", "$", "homeGoals", "as", "$", "homeGoal", ")", "{", "@", "list", "(", "$", "minute", ",", "$", "player", ")", "=", "@", "array_map", "(", "'trim'", ",", "@", "explode", "(", "':'", ",", "$", "homeGoal", ")", ")", ";", "$", "isPenalty", "=", "substr", "(", "$", "player", ",", "0", ",", "7", ")", "===", "'penalty'", ";", "if", "(", "$", "isPenalty", ")", "{", "$", "player", "=", "ltrim", "(", "substr", "(", "$", "player", ",", "8", ")", ")", ";", "}", "$", "isOwn", "=", "substr", "(", "$", "player", ",", "0", ",", "3", ")", "===", "'Own'", ";", "if", "(", "$", "isOwn", ")", "{", "$", "player", "=", "ltrim", "(", "substr", "(", "$", "player", ",", "4", ")", ")", ";", "}", "$", "minute", "=", "rtrim", "(", "$", "minute", ",", "'\\''", ")", ";", "$", "dbGoal", "=", "Yii", "::", "createObject", "(", "[", "'class'", "=>", "$", "this", "->", "goalClass", ",", "'match_id'", "=>", "$", "dbMatch", "->", "id", ",", "'minute'", "=>", "$", "minute", ",", "'team_id'", "=>", "$", "homeTeam", "->", "id", ",", "'player_id'", "=>", "ArrayHelper", "::", "getValue", "(", "(", "$", "isOwn", "?", "$", "awayPlayers", ":", "$", "homePlayers", ")", ",", "[", "$", "player", ",", "'id'", "]", ")", ",", "'owngoal'", "=>", "$", "isOwn", ",", "'penalty'", "=>", "$", "isPenalty", "]", ")", ";", "/* @var $dbGoal \\drsdre\\yii\\xmlsoccer\\models\\Goal */", "if", "(", "!", "$", "dbGoal", "->", "save", "(", ")", ")", "{", "$", "this", "->", "stderr", "(", "\"Failed to save goal '$minute': \"", ",", "Console", "::", "FG_RED", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "foreach", "(", "$", "dbGoal", "->", "errors", "as", "$", "attribute", "=>", "$", "errors", ")", "{", "foreach", "(", "$", "errors", "as", "$", "error", ")", "{", "$", "this", "->", "stderr", "(", "\"$attribute: $error\"", ",", "Console", "::", "BG_YELLOW", ",", "Console", "::", "FG_BLACK", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "}", "}", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "}", "else", "{", "$", "this", "->", "stdout", "(", "\"Goal '$minute' saved\"", ",", "Console", "::", "FG_GREEN", ")", ";", "$", "this", "->", "stdout", "(", "\"\\n\"", ")", ";", "}", "}", "foreach", "(", "$", "awayGoals", "as", "$", "awayGoal", ")", "{", "@", "list", "(", "$", "minute", ",", "$", "player", ")", "=", "@", "array_map", "(", "'trim'", ",", "@", "explode", "(", "':'", ",", "$", "awayGoal", ")", ")", ";", "$", "isPenalty", "=", "substr", "(", "$", "player", ",", "0", ",", "7", ")", "===", "'penalty'", ";", "if", "(", "$", "isPenalty", ")", "{", "$", "player", "=", "ltrim", "(", "substr", "(", "$", "player", ",", "8", ")", ")", ";", "}", "$", "isOwn", "=", "substr", "(", "$", "player", ",", "0", ",", "3", ")", "===", "'Own'", ";", "if", "(", "$", "isOwn", ")", "{", "$", "player", "=", "ltrim", "(", "substr", "(", "$", "player", ",", "4", ")", ")", ";", "}", "$", "minute", "=", "rtrim", "(", "$", "minute", ",", "'\\''", ")", ";", "$", "dbGoal", "=", "Yii", "::", "createObject", "(", "[", "'class'", "=>", "$", "this", "->", "goalClass", ",", "'match_id'", "=>", "$", "dbMatch", "->", "id", ",", "'minute'", "=>", "$", "minute", ",", "'team_id'", "=>", "$", "awayTeam", "->", "id", ",", "'player_id'", "=>", "ArrayHelper", "::", "getValue", "(", "(", "$", "isOwn", "?", "$", "homePlayers", ":", "$", "awayPlayers", ")", ",", "[", "$", "player", ",", "'id'", "]", ")", ",", "'owngoal'", "=>", "$", "isOwn", ",", "'penalty'", "=>", "$", "isPenalty", "]", ")", ";", "/* @var $dbGoal \\drsdre\\yii\\xmlsoccer\\models\\Goal */", "if", "(", "!", "$", "dbGoal", "->", "save", "(", ")", ")", "{", "$", "this", "->", "stderr", "(", "\"Failed to save goal '$minute': \"", ",", "Console", "::", "FG_RED", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "foreach", "(", "$", "dbGoal", "->", "errors", "as", "$", "attribute", "=>", "$", "errors", ")", "{", "foreach", "(", "$", "errors", "as", "$", "error", ")", "{", "$", "this", "->", "stderr", "(", "\"$attribute: $error\"", ",", "Console", "::", "BG_YELLOW", ",", "Console", "::", "FG_BLACK", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "}", "}", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "}", "else", "{", "$", "this", "->", "stdout", "(", "\"Goal '$minute' saved\"", ",", "Console", "::", "FG_GREEN", ")", ";", "$", "this", "->", "stdout", "(", "\"\\n\"", ")", ";", "}", "}", "}", "}", "}", "return", "ExitCode", "::", "OK", ";", "}" ]
Create specific league by id. This method imports all league relevant data from interface to db. If league id is not known, please execute ```sh $ ./yii xml-soccer/show-leagues ``` @param integer $league_id League id to import all data from @param string|null $seasonDateString Season date string to import data from. Defaults to current season. @return int Exit code @throws \yii\base\InvalidConfigException
[ "Create", "specific", "league", "by", "id", ".", "This", "method", "imports", "all", "league", "relevant", "data", "from", "interface", "to", "db", ".", "If", "league", "id", "is", "not", "known", "please", "execute", "sh", "$", ".", "/", "yii", "xml", "-", "soccer", "/", "show", "-", "leagues" ]
train
https://github.com/drsdre/yii2-xmlsoccer/blob/a746edee6269ed0791bac6c6165a946adc30d994/commands/XmlSoccerController.php#L191-L462
drsdre/yii2-xmlsoccer
commands/XmlSoccerController.php
XmlSoccerController.actionUpdateScore
public function actionUpdateScore() { $client = new Client([ 'apiKey' => $this->apiKey ]); $liveScoreData = $client->getLiveScore(); foreach ($liveScoreData as $match) { $dbMatch = call_user_func( [$this->matchClass, 'findOne'], ['interface_id' => ArrayHelper::getValue($match, 'Id')] ); /* @var $dbMatch \drsdre\yii\xmlsoccer\models\Match */ if (!$dbMatch) { continue; } $homeTeam = call_user_func( [$this->teamClass, 'findOne'], ['interface_id' => ArrayHelper::getValue($match, 'HomeTeam_Id')] ); $awayTeam = call_user_func( [$this->teamClass, 'findOne'], ['interface_id' => ArrayHelper::getValue($match, 'AwayTeam_Id')] ); /* @var $homeTeam \drsdre\yii\xmlsoccer\models\Team */ /* @var $awayTeam \drsdre\yii\xmlsoccer\models\Team */ if (ArrayHelper::keyExists('HomeGoalDetails', $match)) { $homeGoals = is_string($tmp = ArrayHelper::getValue($match, 'HomeGoalDetails', '')) ? explode(';', $tmp) : $tmp; $homePlayers = $homeTeam->getPlayers()->indexBy('name')->all(); $awayGoals = is_string($tmp = ArrayHelper::getValue($match, 'AwayGoalDetails', '')) ? explode(';', $tmp) : $tmp; $awayPlayers = $awayTeam->getPlayers()->indexBy('name')->all(); foreach ($homeGoals as $homeGoal) { @list($minute, $player) = @array_map('trim', @explode(':', $homeGoal)); $isPenalty = substr($player, 0, 7) === 'penalty'; if ($isPenalty) { $player = ltrim(substr($player, 8)); } $isOwn = substr($player, 0, 3) === 'Own'; if ($isOwn) { $player = ltrim(substr($player, 4)); } $minute = rtrim($minute, '\''); $dbGoal = call_user_func([$this->goalClass, 'findOne'], [ 'match_id' => $dbMatch->id, 'minute' => $minute ]); /* @var $dbGoal \drsdre\yii\xmlsoccer\models\Goal */ if ($dbGoal) { $this->stdout("Goal '$minute' already exists. Continue...\n"); continue; } $dbGoal = Yii::createObject([ 'class' => $this->goalClass, 'match_id' => $dbMatch->id, 'minute' => $minute, 'team_id' => $homeTeam->id, 'player_id' => ArrayHelper::getValue( ($isOwn ? $awayPlayers : $homePlayers), [$player, 'id'] ), 'owngoal' => $isOwn, 'penalty' => $isPenalty ]); if (!$dbGoal->save()) { $this->stderr("Failed to save goal '$minute': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbGoal->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); } else { $this->stdout("Goal '$minute' saved", Console::FG_GREEN); $this->stdout("\n"); } } foreach ($awayGoals as $awayGoal) { @list($minute, $player) = @array_map('trim', @explode(':', $awayGoal)); $isPenalty = substr($player, 0, 7) === 'penalty'; if ($isPenalty) { $player = ltrim(substr($player, 8)); } $isOwn = substr($player, 0, 3) === 'Own'; if ($isOwn) { $player = ltrim(substr($player, 4)); } $minute = rtrim($minute, '\''); $dbGoal = Yii::createObject([ 'class' => $this->goalClass, 'match_id' => $dbMatch->id, 'minute' => $minute, 'team_id' => $awayTeam->id, 'player_id' => ArrayHelper::getValue( ($isOwn ? $homePlayers : $awayPlayers), [$player, 'id'] ), 'owngoal' => $isOwn, 'penalty' => $isPenalty ]); if (!$dbGoal->save()) { $this->stderr("Failed to save goal '$minute': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbGoal->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); } else { $this->stdout("Goal '$minute' saved", Console::FG_GREEN); $this->stdout("\n"); } } } } return ExitCode::OK; }
php
public function actionUpdateScore() { $client = new Client([ 'apiKey' => $this->apiKey ]); $liveScoreData = $client->getLiveScore(); foreach ($liveScoreData as $match) { $dbMatch = call_user_func( [$this->matchClass, 'findOne'], ['interface_id' => ArrayHelper::getValue($match, 'Id')] ); /* @var $dbMatch \drsdre\yii\xmlsoccer\models\Match */ if (!$dbMatch) { continue; } $homeTeam = call_user_func( [$this->teamClass, 'findOne'], ['interface_id' => ArrayHelper::getValue($match, 'HomeTeam_Id')] ); $awayTeam = call_user_func( [$this->teamClass, 'findOne'], ['interface_id' => ArrayHelper::getValue($match, 'AwayTeam_Id')] ); /* @var $homeTeam \drsdre\yii\xmlsoccer\models\Team */ /* @var $awayTeam \drsdre\yii\xmlsoccer\models\Team */ if (ArrayHelper::keyExists('HomeGoalDetails', $match)) { $homeGoals = is_string($tmp = ArrayHelper::getValue($match, 'HomeGoalDetails', '')) ? explode(';', $tmp) : $tmp; $homePlayers = $homeTeam->getPlayers()->indexBy('name')->all(); $awayGoals = is_string($tmp = ArrayHelper::getValue($match, 'AwayGoalDetails', '')) ? explode(';', $tmp) : $tmp; $awayPlayers = $awayTeam->getPlayers()->indexBy('name')->all(); foreach ($homeGoals as $homeGoal) { @list($minute, $player) = @array_map('trim', @explode(':', $homeGoal)); $isPenalty = substr($player, 0, 7) === 'penalty'; if ($isPenalty) { $player = ltrim(substr($player, 8)); } $isOwn = substr($player, 0, 3) === 'Own'; if ($isOwn) { $player = ltrim(substr($player, 4)); } $minute = rtrim($minute, '\''); $dbGoal = call_user_func([$this->goalClass, 'findOne'], [ 'match_id' => $dbMatch->id, 'minute' => $minute ]); /* @var $dbGoal \drsdre\yii\xmlsoccer\models\Goal */ if ($dbGoal) { $this->stdout("Goal '$minute' already exists. Continue...\n"); continue; } $dbGoal = Yii::createObject([ 'class' => $this->goalClass, 'match_id' => $dbMatch->id, 'minute' => $minute, 'team_id' => $homeTeam->id, 'player_id' => ArrayHelper::getValue( ($isOwn ? $awayPlayers : $homePlayers), [$player, 'id'] ), 'owngoal' => $isOwn, 'penalty' => $isPenalty ]); if (!$dbGoal->save()) { $this->stderr("Failed to save goal '$minute': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbGoal->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); } else { $this->stdout("Goal '$minute' saved", Console::FG_GREEN); $this->stdout("\n"); } } foreach ($awayGoals as $awayGoal) { @list($minute, $player) = @array_map('trim', @explode(':', $awayGoal)); $isPenalty = substr($player, 0, 7) === 'penalty'; if ($isPenalty) { $player = ltrim(substr($player, 8)); } $isOwn = substr($player, 0, 3) === 'Own'; if ($isOwn) { $player = ltrim(substr($player, 4)); } $minute = rtrim($minute, '\''); $dbGoal = Yii::createObject([ 'class' => $this->goalClass, 'match_id' => $dbMatch->id, 'minute' => $minute, 'team_id' => $awayTeam->id, 'player_id' => ArrayHelper::getValue( ($isOwn ? $homePlayers : $awayPlayers), [$player, 'id'] ), 'owngoal' => $isOwn, 'penalty' => $isPenalty ]); if (!$dbGoal->save()) { $this->stderr("Failed to save goal '$minute': ", Console::FG_RED); $this->stderr("\n"); foreach ($dbGoal->errors as $attribute => $errors) { foreach ($errors as $error) { $this->stderr("$attribute: $error", Console::BG_YELLOW, Console::FG_BLACK); $this->stderr("\n"); } } $this->stderr("\n"); } else { $this->stdout("Goal '$minute' saved", Console::FG_GREEN); $this->stdout("\n"); } } } } return ExitCode::OK; }
[ "public", "function", "actionUpdateScore", "(", ")", "{", "$", "client", "=", "new", "Client", "(", "[", "'apiKey'", "=>", "$", "this", "->", "apiKey", "]", ")", ";", "$", "liveScoreData", "=", "$", "client", "->", "getLiveScore", "(", ")", ";", "foreach", "(", "$", "liveScoreData", "as", "$", "match", ")", "{", "$", "dbMatch", "=", "call_user_func", "(", "[", "$", "this", "->", "matchClass", ",", "'findOne'", "]", ",", "[", "'interface_id'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "match", ",", "'Id'", ")", "]", ")", ";", "/* @var $dbMatch \\drsdre\\yii\\xmlsoccer\\models\\Match */", "if", "(", "!", "$", "dbMatch", ")", "{", "continue", ";", "}", "$", "homeTeam", "=", "call_user_func", "(", "[", "$", "this", "->", "teamClass", ",", "'findOne'", "]", ",", "[", "'interface_id'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "match", ",", "'HomeTeam_Id'", ")", "]", ")", ";", "$", "awayTeam", "=", "call_user_func", "(", "[", "$", "this", "->", "teamClass", ",", "'findOne'", "]", ",", "[", "'interface_id'", "=>", "ArrayHelper", "::", "getValue", "(", "$", "match", ",", "'AwayTeam_Id'", ")", "]", ")", ";", "/* @var $homeTeam \\drsdre\\yii\\xmlsoccer\\models\\Team */", "/* @var $awayTeam \\drsdre\\yii\\xmlsoccer\\models\\Team */", "if", "(", "ArrayHelper", "::", "keyExists", "(", "'HomeGoalDetails'", ",", "$", "match", ")", ")", "{", "$", "homeGoals", "=", "is_string", "(", "$", "tmp", "=", "ArrayHelper", "::", "getValue", "(", "$", "match", ",", "'HomeGoalDetails'", ",", "''", ")", ")", "?", "explode", "(", "';'", ",", "$", "tmp", ")", ":", "$", "tmp", ";", "$", "homePlayers", "=", "$", "homeTeam", "->", "getPlayers", "(", ")", "->", "indexBy", "(", "'name'", ")", "->", "all", "(", ")", ";", "$", "awayGoals", "=", "is_string", "(", "$", "tmp", "=", "ArrayHelper", "::", "getValue", "(", "$", "match", ",", "'AwayGoalDetails'", ",", "''", ")", ")", "?", "explode", "(", "';'", ",", "$", "tmp", ")", ":", "$", "tmp", ";", "$", "awayPlayers", "=", "$", "awayTeam", "->", "getPlayers", "(", ")", "->", "indexBy", "(", "'name'", ")", "->", "all", "(", ")", ";", "foreach", "(", "$", "homeGoals", "as", "$", "homeGoal", ")", "{", "@", "list", "(", "$", "minute", ",", "$", "player", ")", "=", "@", "array_map", "(", "'trim'", ",", "@", "explode", "(", "':'", ",", "$", "homeGoal", ")", ")", ";", "$", "isPenalty", "=", "substr", "(", "$", "player", ",", "0", ",", "7", ")", "===", "'penalty'", ";", "if", "(", "$", "isPenalty", ")", "{", "$", "player", "=", "ltrim", "(", "substr", "(", "$", "player", ",", "8", ")", ")", ";", "}", "$", "isOwn", "=", "substr", "(", "$", "player", ",", "0", ",", "3", ")", "===", "'Own'", ";", "if", "(", "$", "isOwn", ")", "{", "$", "player", "=", "ltrim", "(", "substr", "(", "$", "player", ",", "4", ")", ")", ";", "}", "$", "minute", "=", "rtrim", "(", "$", "minute", ",", "'\\''", ")", ";", "$", "dbGoal", "=", "call_user_func", "(", "[", "$", "this", "->", "goalClass", ",", "'findOne'", "]", ",", "[", "'match_id'", "=>", "$", "dbMatch", "->", "id", ",", "'minute'", "=>", "$", "minute", "]", ")", ";", "/* @var $dbGoal \\drsdre\\yii\\xmlsoccer\\models\\Goal */", "if", "(", "$", "dbGoal", ")", "{", "$", "this", "->", "stdout", "(", "\"Goal '$minute' already exists. Continue...\\n\"", ")", ";", "continue", ";", "}", "$", "dbGoal", "=", "Yii", "::", "createObject", "(", "[", "'class'", "=>", "$", "this", "->", "goalClass", ",", "'match_id'", "=>", "$", "dbMatch", "->", "id", ",", "'minute'", "=>", "$", "minute", ",", "'team_id'", "=>", "$", "homeTeam", "->", "id", ",", "'player_id'", "=>", "ArrayHelper", "::", "getValue", "(", "(", "$", "isOwn", "?", "$", "awayPlayers", ":", "$", "homePlayers", ")", ",", "[", "$", "player", ",", "'id'", "]", ")", ",", "'owngoal'", "=>", "$", "isOwn", ",", "'penalty'", "=>", "$", "isPenalty", "]", ")", ";", "if", "(", "!", "$", "dbGoal", "->", "save", "(", ")", ")", "{", "$", "this", "->", "stderr", "(", "\"Failed to save goal '$minute': \"", ",", "Console", "::", "FG_RED", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "foreach", "(", "$", "dbGoal", "->", "errors", "as", "$", "attribute", "=>", "$", "errors", ")", "{", "foreach", "(", "$", "errors", "as", "$", "error", ")", "{", "$", "this", "->", "stderr", "(", "\"$attribute: $error\"", ",", "Console", "::", "BG_YELLOW", ",", "Console", "::", "FG_BLACK", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "}", "}", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "}", "else", "{", "$", "this", "->", "stdout", "(", "\"Goal '$minute' saved\"", ",", "Console", "::", "FG_GREEN", ")", ";", "$", "this", "->", "stdout", "(", "\"\\n\"", ")", ";", "}", "}", "foreach", "(", "$", "awayGoals", "as", "$", "awayGoal", ")", "{", "@", "list", "(", "$", "minute", ",", "$", "player", ")", "=", "@", "array_map", "(", "'trim'", ",", "@", "explode", "(", "':'", ",", "$", "awayGoal", ")", ")", ";", "$", "isPenalty", "=", "substr", "(", "$", "player", ",", "0", ",", "7", ")", "===", "'penalty'", ";", "if", "(", "$", "isPenalty", ")", "{", "$", "player", "=", "ltrim", "(", "substr", "(", "$", "player", ",", "8", ")", ")", ";", "}", "$", "isOwn", "=", "substr", "(", "$", "player", ",", "0", ",", "3", ")", "===", "'Own'", ";", "if", "(", "$", "isOwn", ")", "{", "$", "player", "=", "ltrim", "(", "substr", "(", "$", "player", ",", "4", ")", ")", ";", "}", "$", "minute", "=", "rtrim", "(", "$", "minute", ",", "'\\''", ")", ";", "$", "dbGoal", "=", "Yii", "::", "createObject", "(", "[", "'class'", "=>", "$", "this", "->", "goalClass", ",", "'match_id'", "=>", "$", "dbMatch", "->", "id", ",", "'minute'", "=>", "$", "minute", ",", "'team_id'", "=>", "$", "awayTeam", "->", "id", ",", "'player_id'", "=>", "ArrayHelper", "::", "getValue", "(", "(", "$", "isOwn", "?", "$", "homePlayers", ":", "$", "awayPlayers", ")", ",", "[", "$", "player", ",", "'id'", "]", ")", ",", "'owngoal'", "=>", "$", "isOwn", ",", "'penalty'", "=>", "$", "isPenalty", "]", ")", ";", "if", "(", "!", "$", "dbGoal", "->", "save", "(", ")", ")", "{", "$", "this", "->", "stderr", "(", "\"Failed to save goal '$minute': \"", ",", "Console", "::", "FG_RED", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "foreach", "(", "$", "dbGoal", "->", "errors", "as", "$", "attribute", "=>", "$", "errors", ")", "{", "foreach", "(", "$", "errors", "as", "$", "error", ")", "{", "$", "this", "->", "stderr", "(", "\"$attribute: $error\"", ",", "Console", "::", "BG_YELLOW", ",", "Console", "::", "FG_BLACK", ")", ";", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "}", "}", "$", "this", "->", "stderr", "(", "\"\\n\"", ")", ";", "}", "else", "{", "$", "this", "->", "stdout", "(", "\"Goal '$minute' saved\"", ",", "Console", "::", "FG_GREEN", ")", ";", "$", "this", "->", "stdout", "(", "\"\\n\"", ")", ";", "}", "}", "}", "}", "return", "ExitCode", "::", "OK", ";", "}" ]
Update Scores from LiveScore @return integer Exit code @throws \yii\base\InvalidConfigException
[ "Update", "Scores", "from", "LiveScore" ]
train
https://github.com/drsdre/yii2-xmlsoccer/blob/a746edee6269ed0791bac6c6165a946adc30d994/commands/XmlSoccerController.php#L470-L601
Chill-project/Main
Command/LoadCountriesCommand.php
LoadCountriesCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $countries = static::prepareCountryList($this->getContainer()->getParameter('chill_main.available_languages')); $em = $this->getContainer()->get('doctrine.orm.entity_manager'); foreach($countries as $country) { $countryStored = $em->getRepository('ChillMainBundle:Country') ->findOneBy(array('countryCode' => $country->getCountryCode())); if (NULL === $countryStored) { $em->persist($country); } else { $countryStored->setName($country->getName()); } } $em->flush(); }
php
protected function execute(InputInterface $input, OutputInterface $output) { $countries = static::prepareCountryList($this->getContainer()->getParameter('chill_main.available_languages')); $em = $this->getContainer()->get('doctrine.orm.entity_manager'); foreach($countries as $country) { $countryStored = $em->getRepository('ChillMainBundle:Country') ->findOneBy(array('countryCode' => $country->getCountryCode())); if (NULL === $countryStored) { $em->persist($country); } else { $countryStored->setName($country->getName()); } } $em->flush(); }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "countries", "=", "static", "::", "prepareCountryList", "(", "$", "this", "->", "getContainer", "(", ")", "->", "getParameter", "(", "'chill_main.available_languages'", ")", ")", ";", "$", "em", "=", "$", "this", "->", "getContainer", "(", ")", "->", "get", "(", "'doctrine.orm.entity_manager'", ")", ";", "foreach", "(", "$", "countries", "as", "$", "country", ")", "{", "$", "countryStored", "=", "$", "em", "->", "getRepository", "(", "'ChillMainBundle:Country'", ")", "->", "findOneBy", "(", "array", "(", "'countryCode'", "=>", "$", "country", "->", "getCountryCode", "(", ")", ")", ")", ";", "if", "(", "NULL", "===", "$", "countryStored", ")", "{", "$", "em", "->", "persist", "(", "$", "country", ")", ";", "}", "else", "{", "$", "countryStored", "->", "setName", "(", "$", "country", "->", "getName", "(", ")", ")", ";", "}", "}", "$", "em", "->", "flush", "(", ")", ";", "}" ]
/* (non-PHPdoc) @see \Symfony\Component\Console\Command\Command::execute()
[ "/", "*", "(", "non", "-", "PHPdoc", ")" ]
train
https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Command/LoadCountriesCommand.php#L32-L49
VincentChalnot/SidusAdminBundle
Controller/AbstractAdminController.php
AbstractAdminController.bindDataGridRequest
protected function bindDataGridRequest(DataGrid $dataGrid, Request $request, array $formOptions = []) { $formOptions = array_merge( [ 'method' => $request->getMethod(), 'csrf_protection' => false, 'action' => $this->getCurrentUri($request), 'validation_groups' => ['filters'], ], $formOptions ); // Create form with filters $builder = $this->createFormBuilder(null, $formOptions); $dataGrid->buildForm($builder); $dataGrid->handleRequest($request); }
php
protected function bindDataGridRequest(DataGrid $dataGrid, Request $request, array $formOptions = []) { $formOptions = array_merge( [ 'method' => $request->getMethod(), 'csrf_protection' => false, 'action' => $this->getCurrentUri($request), 'validation_groups' => ['filters'], ], $formOptions ); // Create form with filters $builder = $this->createFormBuilder(null, $formOptions); $dataGrid->buildForm($builder); $dataGrid->handleRequest($request); }
[ "protected", "function", "bindDataGridRequest", "(", "DataGrid", "$", "dataGrid", ",", "Request", "$", "request", ",", "array", "$", "formOptions", "=", "[", "]", ")", "{", "$", "formOptions", "=", "array_merge", "(", "[", "'method'", "=>", "$", "request", "->", "getMethod", "(", ")", ",", "'csrf_protection'", "=>", "false", ",", "'action'", "=>", "$", "this", "->", "getCurrentUri", "(", "$", "request", ")", ",", "'validation_groups'", "=>", "[", "'filters'", "]", ",", "]", ",", "$", "formOptions", ")", ";", "// Create form with filters", "$", "builder", "=", "$", "this", "->", "createFormBuilder", "(", "null", ",", "$", "formOptions", ")", ";", "$", "dataGrid", "->", "buildForm", "(", "$", "builder", ")", ";", "$", "dataGrid", "->", "handleRequest", "(", "$", "request", ")", ";", "}" ]
@param DataGrid $dataGrid @param Request $request @param array $formOptions @throws \Exception
[ "@param", "DataGrid", "$dataGrid", "@param", "Request", "$request", "@param", "array", "$formOptions" ]
train
https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Controller/AbstractAdminController.php#L85-L101
VincentChalnot/SidusAdminBundle
Controller/AbstractAdminController.php
AbstractAdminController.getForm
protected function getForm(Request $request, $data, array $options = []): FormInterface { $action = $this->admin->getCurrentAction(); $dataId = $data && method_exists($data, 'getId') ? $data->getId() : null; $defaultOptions = $this->getDefaultFormOptions($request, $dataId, $action); return $this->getFormBuilder($action, $data, array_merge($defaultOptions, $options))->getForm(); }
php
protected function getForm(Request $request, $data, array $options = []): FormInterface { $action = $this->admin->getCurrentAction(); $dataId = $data && method_exists($data, 'getId') ? $data->getId() : null; $defaultOptions = $this->getDefaultFormOptions($request, $dataId, $action); return $this->getFormBuilder($action, $data, array_merge($defaultOptions, $options))->getForm(); }
[ "protected", "function", "getForm", "(", "Request", "$", "request", ",", "$", "data", ",", "array", "$", "options", "=", "[", "]", ")", ":", "FormInterface", "{", "$", "action", "=", "$", "this", "->", "admin", "->", "getCurrentAction", "(", ")", ";", "$", "dataId", "=", "$", "data", "&&", "method_exists", "(", "$", "data", ",", "'getId'", ")", "?", "$", "data", "->", "getId", "(", ")", ":", "null", ";", "$", "defaultOptions", "=", "$", "this", "->", "getDefaultFormOptions", "(", "$", "request", ",", "$", "dataId", ",", "$", "action", ")", ";", "return", "$", "this", "->", "getFormBuilder", "(", "$", "action", ",", "$", "data", ",", "array_merge", "(", "$", "defaultOptions", ",", "$", "options", ")", ")", "->", "getForm", "(", ")", ";", "}" ]
@param Request $request @param mixed $data @param array $options @throws \UnexpectedValueException @throws \InvalidArgumentException @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException @return FormInterface
[ "@param", "Request", "$request", "@param", "mixed", "$data", "@param", "array", "$options" ]
train
https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Controller/AbstractAdminController.php#L114-L121
VincentChalnot/SidusAdminBundle
Controller/AbstractAdminController.php
AbstractAdminController.getFormBuilder
protected function getFormBuilder(Action $action, $data, array $options = []): FormBuilderInterface { if (!$action->getFormType()) { throw new \UnexpectedValueException("Missing parameter 'form_type' for action '{$action->getCode()}'"); } return $this->get('form.factory')->createNamedBuilder( "form_{$this->admin->getCode()}_{$action->getCode()}", $action->getFormType(), $data, $options ); }
php
protected function getFormBuilder(Action $action, $data, array $options = []): FormBuilderInterface { if (!$action->getFormType()) { throw new \UnexpectedValueException("Missing parameter 'form_type' for action '{$action->getCode()}'"); } return $this->get('form.factory')->createNamedBuilder( "form_{$this->admin->getCode()}_{$action->getCode()}", $action->getFormType(), $data, $options ); }
[ "protected", "function", "getFormBuilder", "(", "Action", "$", "action", ",", "$", "data", ",", "array", "$", "options", "=", "[", "]", ")", ":", "FormBuilderInterface", "{", "if", "(", "!", "$", "action", "->", "getFormType", "(", ")", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "\"Missing parameter 'form_type' for action '{$action->getCode()}'\"", ")", ";", "}", "return", "$", "this", "->", "get", "(", "'form.factory'", ")", "->", "createNamedBuilder", "(", "\"form_{$this->admin->getCode()}_{$action->getCode()}\"", ",", "$", "action", "->", "getFormType", "(", ")", ",", "$", "data", ",", "$", "options", ")", ";", "}" ]
@param Action $action @param mixed $data @param array $options @throws \UnexpectedValueException @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException @return FormBuilderInterface
[ "@param", "Action", "$action", "@param", "mixed", "$data", "@param", "array", "$options" ]
train
https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Controller/AbstractAdminController.php#L133-L145
VincentChalnot/SidusAdminBundle
Controller/AbstractAdminController.php
AbstractAdminController.saveEntity
protected function saveEntity($data) { $entityManager = $this->getManagerForEntity($data); $entityManager->persist($data); $entityManager->flush(); $action = $this->admin->getCurrentAction(); $this->addFlash('success', $this->translate("admin.flash.{$action->getCode()}.success")); }
php
protected function saveEntity($data) { $entityManager = $this->getManagerForEntity($data); $entityManager->persist($data); $entityManager->flush(); $action = $this->admin->getCurrentAction(); $this->addFlash('success', $this->translate("admin.flash.{$action->getCode()}.success")); }
[ "protected", "function", "saveEntity", "(", "$", "data", ")", "{", "$", "entityManager", "=", "$", "this", "->", "getManagerForEntity", "(", "$", "data", ")", ";", "$", "entityManager", "->", "persist", "(", "$", "data", ")", ";", "$", "entityManager", "->", "flush", "(", ")", ";", "$", "action", "=", "$", "this", "->", "admin", "->", "getCurrentAction", "(", ")", ";", "$", "this", "->", "addFlash", "(", "'success'", ",", "$", "this", "->", "translate", "(", "\"admin.flash.{$action->getCode()}.success\"", ")", ")", ";", "}" ]
@param mixed $data @throws \Exception
[ "@param", "mixed", "$data" ]
train
https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Controller/AbstractAdminController.php#L152-L160
VincentChalnot/SidusAdminBundle
Controller/AbstractAdminController.php
AbstractAdminController.deleteEntity
protected function deleteEntity($data) { $entityManager = $this->getManagerForEntity($data); $entityManager->remove($data); $entityManager->flush(); $action = $this->admin->getCurrentAction(); $this->addFlash('success', $this->translate("admin.flash.{$action->getCode()}.success")); }
php
protected function deleteEntity($data) { $entityManager = $this->getManagerForEntity($data); $entityManager->remove($data); $entityManager->flush(); $action = $this->admin->getCurrentAction(); $this->addFlash('success', $this->translate("admin.flash.{$action->getCode()}.success")); }
[ "protected", "function", "deleteEntity", "(", "$", "data", ")", "{", "$", "entityManager", "=", "$", "this", "->", "getManagerForEntity", "(", "$", "data", ")", ";", "$", "entityManager", "->", "remove", "(", "$", "data", ")", ";", "$", "entityManager", "->", "flush", "(", ")", ";", "$", "action", "=", "$", "this", "->", "admin", "->", "getCurrentAction", "(", ")", ";", "$", "this", "->", "addFlash", "(", "'success'", ",", "$", "this", "->", "translate", "(", "\"admin.flash.{$action->getCode()}.success\"", ")", ")", ";", "}" ]
@param mixed $data @throws \Exception
[ "@param", "mixed", "$data" ]
train
https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Controller/AbstractAdminController.php#L167-L175
VincentChalnot/SidusAdminBundle
Controller/AbstractAdminController.php
AbstractAdminController.getDefaultFormOptions
protected function getDefaultFormOptions(Request $request, $dataId, Action $action = null) { if (!$action) { $action = $this->admin->getCurrentAction(); } $dataId = $dataId ?: 'new'; return array_merge( $action->getFormOptions(), [ 'action' => $this->getCurrentUri($request), 'attr' => [ 'novalidate' => 'novalidate', 'id' => "form_{$this->admin->getCode()}_{$action->getCode()}_{$dataId}", ], 'method' => 'post', ] ); }
php
protected function getDefaultFormOptions(Request $request, $dataId, Action $action = null) { if (!$action) { $action = $this->admin->getCurrentAction(); } $dataId = $dataId ?: 'new'; return array_merge( $action->getFormOptions(), [ 'action' => $this->getCurrentUri($request), 'attr' => [ 'novalidate' => 'novalidate', 'id' => "form_{$this->admin->getCode()}_{$action->getCode()}_{$dataId}", ], 'method' => 'post', ] ); }
[ "protected", "function", "getDefaultFormOptions", "(", "Request", "$", "request", ",", "$", "dataId", ",", "Action", "$", "action", "=", "null", ")", "{", "if", "(", "!", "$", "action", ")", "{", "$", "action", "=", "$", "this", "->", "admin", "->", "getCurrentAction", "(", ")", ";", "}", "$", "dataId", "=", "$", "dataId", "?", ":", "'new'", ";", "return", "array_merge", "(", "$", "action", "->", "getFormOptions", "(", ")", ",", "[", "'action'", "=>", "$", "this", "->", "getCurrentUri", "(", "$", "request", ")", ",", "'attr'", "=>", "[", "'novalidate'", "=>", "'novalidate'", ",", "'id'", "=>", "\"form_{$this->admin->getCode()}_{$action->getCode()}_{$dataId}\"", ",", "]", ",", "'method'", "=>", "'post'", ",", "]", ")", ";", "}" ]
@param Request $request @param string $dataId @param Action|null $action @throws \InvalidArgumentException @return array
[ "@param", "Request", "$request", "@param", "string", "$dataId", "@param", "Action|null", "$action" ]
train
https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Controller/AbstractAdminController.php#L186-L204