repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
silverstripe/silverstripe-framework | src/ORM/Connect/DBQueryBuilder.php | DBQueryBuilder.buildSelectQuery | protected function buildSelectQuery(SQLSelect $query, array &$parameters)
{
$sql = $this->buildSelectFragment($query, $parameters);
$sql .= $this->buildFromFragment($query, $parameters);
$sql .= $this->buildWhereFragment($query, $parameters);
$sql .= $this->buildGroupByFragment($que... | php | protected function buildSelectQuery(SQLSelect $query, array &$parameters)
{
$sql = $this->buildSelectFragment($query, $parameters);
$sql .= $this->buildFromFragment($query, $parameters);
$sql .= $this->buildWhereFragment($query, $parameters);
$sql .= $this->buildGroupByFragment($que... | [
"protected",
"function",
"buildSelectQuery",
"(",
"SQLSelect",
"$",
"query",
",",
"array",
"&",
"$",
"parameters",
")",
"{",
"$",
"sql",
"=",
"$",
"this",
"->",
"buildSelectFragment",
"(",
"$",
"query",
",",
"$",
"parameters",
")",
";",
"$",
"sql",
".=",... | Builds a query from a SQLSelect expression
@param SQLSelect $query The expression object to build from
@param array $parameters Out parameter for the resulting query parameters
@return string Completed SQL string | [
"Builds",
"a",
"query",
"from",
"a",
"SQLSelect",
"expression"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBQueryBuilder.php#L69-L79 | train |
silverstripe/silverstripe-framework | src/ORM/Connect/DBQueryBuilder.php | DBQueryBuilder.buildDeleteQuery | protected function buildDeleteQuery(SQLDelete $query, array &$parameters)
{
$sql = $this->buildDeleteFragment($query, $parameters);
$sql .= $this->buildFromFragment($query, $parameters);
$sql .= $this->buildWhereFragment($query, $parameters);
return $sql;
} | php | protected function buildDeleteQuery(SQLDelete $query, array &$parameters)
{
$sql = $this->buildDeleteFragment($query, $parameters);
$sql .= $this->buildFromFragment($query, $parameters);
$sql .= $this->buildWhereFragment($query, $parameters);
return $sql;
} | [
"protected",
"function",
"buildDeleteQuery",
"(",
"SQLDelete",
"$",
"query",
",",
"array",
"&",
"$",
"parameters",
")",
"{",
"$",
"sql",
"=",
"$",
"this",
"->",
"buildDeleteFragment",
"(",
"$",
"query",
",",
"$",
"parameters",
")",
";",
"$",
"sql",
".=",... | Builds a query from a SQLDelete expression
@param SQLDelete $query The expression object to build from
@param array $parameters Out parameter for the resulting query parameters
@return string Completed SQL string | [
"Builds",
"a",
"query",
"from",
"a",
"SQLDelete",
"expression"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBQueryBuilder.php#L88-L94 | train |
silverstripe/silverstripe-framework | src/ORM/Connect/DBQueryBuilder.php | DBQueryBuilder.buildInsertQuery | protected function buildInsertQuery(SQLInsert $query, array &$parameters)
{
$nl = $this->getSeparator();
$into = $query->getInto();
// Column identifiers
$columns = $query->getColumns();
$sql = "INSERT INTO {$into}{$nl}(" . implode(', ', $columns) . ")";
// Values
... | php | protected function buildInsertQuery(SQLInsert $query, array &$parameters)
{
$nl = $this->getSeparator();
$into = $query->getInto();
// Column identifiers
$columns = $query->getColumns();
$sql = "INSERT INTO {$into}{$nl}(" . implode(', ', $columns) . ")";
// Values
... | [
"protected",
"function",
"buildInsertQuery",
"(",
"SQLInsert",
"$",
"query",
",",
"array",
"&",
"$",
"parameters",
")",
"{",
"$",
"nl",
"=",
"$",
"this",
"->",
"getSeparator",
"(",
")",
";",
"$",
"into",
"=",
"$",
"query",
"->",
"getInto",
"(",
")",
... | Builds a query from a SQLInsert expression
@param SQLInsert $query The expression object to build from
@param array $parameters Out parameter for the resulting query parameters
@return string Completed SQL string | [
"Builds",
"a",
"query",
"from",
"a",
"SQLInsert",
"expression"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBQueryBuilder.php#L103-L142 | train |
silverstripe/silverstripe-framework | src/ORM/Connect/DBQueryBuilder.php | DBQueryBuilder.buildUpdateQuery | protected function buildUpdateQuery(SQLUpdate $query, array &$parameters)
{
$sql = $this->buildUpdateFragment($query, $parameters);
$sql .= $this->buildWhereFragment($query, $parameters);
return $sql;
} | php | protected function buildUpdateQuery(SQLUpdate $query, array &$parameters)
{
$sql = $this->buildUpdateFragment($query, $parameters);
$sql .= $this->buildWhereFragment($query, $parameters);
return $sql;
} | [
"protected",
"function",
"buildUpdateQuery",
"(",
"SQLUpdate",
"$",
"query",
",",
"array",
"&",
"$",
"parameters",
")",
"{",
"$",
"sql",
"=",
"$",
"this",
"->",
"buildUpdateFragment",
"(",
"$",
"query",
",",
"$",
"parameters",
")",
";",
"$",
"sql",
".=",... | Builds a query from a SQLUpdate expression
@param SQLUpdate $query The expression object to build from
@param array $parameters Out parameter for the resulting query parameters
@return string Completed SQL string | [
"Builds",
"a",
"query",
"from",
"a",
"SQLUpdate",
"expression"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBQueryBuilder.php#L151-L156 | train |
silverstripe/silverstripe-framework | src/ORM/Connect/DBQueryBuilder.php | DBQueryBuilder.buildSelectFragment | protected function buildSelectFragment(SQLSelect $query, array &$parameters)
{
$distinct = $query->getDistinct();
$select = $query->getSelect();
$clauses = array();
foreach ($select as $alias => $field) {
// Don't include redundant aliases.
$fieldAlias = "\"{... | php | protected function buildSelectFragment(SQLSelect $query, array &$parameters)
{
$distinct = $query->getDistinct();
$select = $query->getSelect();
$clauses = array();
foreach ($select as $alias => $field) {
// Don't include redundant aliases.
$fieldAlias = "\"{... | [
"protected",
"function",
"buildSelectFragment",
"(",
"SQLSelect",
"$",
"query",
",",
"array",
"&",
"$",
"parameters",
")",
"{",
"$",
"distinct",
"=",
"$",
"query",
"->",
"getDistinct",
"(",
")",
";",
"$",
"select",
"=",
"$",
"query",
"->",
"getSelect",
"... | Returns the SELECT clauses ready for inserting into a query.
@param SQLSelect $query The expression object to build from
@param array $parameters Out parameter for the resulting query parameters
@return string Completed select part of statement | [
"Returns",
"the",
"SELECT",
"clauses",
"ready",
"for",
"inserting",
"into",
"a",
"query",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBQueryBuilder.php#L165-L186 | train |
silverstripe/silverstripe-framework | src/ORM/Connect/DBQueryBuilder.php | DBQueryBuilder.buildDeleteFragment | public function buildDeleteFragment(SQLDelete $query, array &$parameters)
{
$text = 'DELETE';
// If doing a multiple table delete then list the target deletion tables here
// Note that some schemas don't support multiple table deletion
$delete = $query->getDelete();
if (!emp... | php | public function buildDeleteFragment(SQLDelete $query, array &$parameters)
{
$text = 'DELETE';
// If doing a multiple table delete then list the target deletion tables here
// Note that some schemas don't support multiple table deletion
$delete = $query->getDelete();
if (!emp... | [
"public",
"function",
"buildDeleteFragment",
"(",
"SQLDelete",
"$",
"query",
",",
"array",
"&",
"$",
"parameters",
")",
"{",
"$",
"text",
"=",
"'DELETE'",
";",
"// If doing a multiple table delete then list the target deletion tables here",
"// Note that some schemas don't su... | Return the DELETE clause ready for inserting into a query.
@param SQLDelete $query The expression object to build from
@param array $parameters Out parameter for the resulting query parameters
@return string Completed delete part of statement | [
"Return",
"the",
"DELETE",
"clause",
"ready",
"for",
"inserting",
"into",
"a",
"query",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBQueryBuilder.php#L195-L206 | train |
silverstripe/silverstripe-framework | src/ORM/Connect/DBQueryBuilder.php | DBQueryBuilder.buildUpdateFragment | public function buildUpdateFragment(SQLUpdate $query, array &$parameters)
{
$table = $query->getTable();
$text = "UPDATE $table";
// Join SET components together, considering parameters
$parts = array();
foreach ($query->getAssignments() as $column => $assignment) {
... | php | public function buildUpdateFragment(SQLUpdate $query, array &$parameters)
{
$table = $query->getTable();
$text = "UPDATE $table";
// Join SET components together, considering parameters
$parts = array();
foreach ($query->getAssignments() as $column => $assignment) {
... | [
"public",
"function",
"buildUpdateFragment",
"(",
"SQLUpdate",
"$",
"query",
",",
"array",
"&",
"$",
"parameters",
")",
"{",
"$",
"table",
"=",
"$",
"query",
"->",
"getTable",
"(",
")",
";",
"$",
"text",
"=",
"\"UPDATE $table\"",
";",
"// Join SET components... | Return the UPDATE clause ready for inserting into a query.
@param SQLUpdate $query The expression object to build from
@param array $parameters Out parameter for the resulting query parameters
@return string Completed from part of statement | [
"Return",
"the",
"UPDATE",
"clause",
"ready",
"for",
"inserting",
"into",
"a",
"query",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBQueryBuilder.php#L215-L233 | train |
silverstripe/silverstripe-framework | src/ORM/Connect/DBQueryBuilder.php | DBQueryBuilder.buildFromFragment | public function buildFromFragment(SQLConditionalExpression $query, array &$parameters)
{
$from = $query->getJoins($joinParameters);
$parameters = array_merge($parameters, $joinParameters);
$nl = $this->getSeparator();
return "{$nl}FROM " . implode(' ', $from);
} | php | public function buildFromFragment(SQLConditionalExpression $query, array &$parameters)
{
$from = $query->getJoins($joinParameters);
$parameters = array_merge($parameters, $joinParameters);
$nl = $this->getSeparator();
return "{$nl}FROM " . implode(' ', $from);
} | [
"public",
"function",
"buildFromFragment",
"(",
"SQLConditionalExpression",
"$",
"query",
",",
"array",
"&",
"$",
"parameters",
")",
"{",
"$",
"from",
"=",
"$",
"query",
"->",
"getJoins",
"(",
"$",
"joinParameters",
")",
";",
"$",
"parameters",
"=",
"array_m... | Return the FROM clause ready for inserting into a query.
@param SQLConditionalExpression $query The expression object to build from
@param array $parameters Out parameter for the resulting query parameters
@return string Completed from part of statement | [
"Return",
"the",
"FROM",
"clause",
"ready",
"for",
"inserting",
"into",
"a",
"query",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBQueryBuilder.php#L242-L248 | train |
silverstripe/silverstripe-framework | src/ORM/Connect/DBQueryBuilder.php | DBQueryBuilder.buildWhereFragment | public function buildWhereFragment(SQLConditionalExpression $query, array &$parameters)
{
// Get parameterised elements
$where = $query->getWhereParameterised($whereParameters);
if (empty($where)) {
return '';
}
// Join conditions
$connective = $query->ge... | php | public function buildWhereFragment(SQLConditionalExpression $query, array &$parameters)
{
// Get parameterised elements
$where = $query->getWhereParameterised($whereParameters);
if (empty($where)) {
return '';
}
// Join conditions
$connective = $query->ge... | [
"public",
"function",
"buildWhereFragment",
"(",
"SQLConditionalExpression",
"$",
"query",
",",
"array",
"&",
"$",
"parameters",
")",
"{",
"// Get parameterised elements",
"$",
"where",
"=",
"$",
"query",
"->",
"getWhereParameterised",
"(",
"$",
"whereParameters",
"... | Returns the WHERE clauses ready for inserting into a query.
@param SQLConditionalExpression $query The expression object to build from
@param array $parameters Out parameter for the resulting query parameters
@return string Completed where condition | [
"Returns",
"the",
"WHERE",
"clauses",
"ready",
"for",
"inserting",
"into",
"a",
"query",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBQueryBuilder.php#L257-L270 | train |
silverstripe/silverstripe-framework | src/ORM/Connect/DBQueryBuilder.php | DBQueryBuilder.buildOrderByFragment | public function buildOrderByFragment(SQLSelect $query, array &$parameters)
{
$orderBy = $query->getOrderBy();
if (empty($orderBy)) {
return '';
}
// Build orders, each with direction considered
$statements = array();
foreach ($orderBy as $clause => $dir) ... | php | public function buildOrderByFragment(SQLSelect $query, array &$parameters)
{
$orderBy = $query->getOrderBy();
if (empty($orderBy)) {
return '';
}
// Build orders, each with direction considered
$statements = array();
foreach ($orderBy as $clause => $dir) ... | [
"public",
"function",
"buildOrderByFragment",
"(",
"SQLSelect",
"$",
"query",
",",
"array",
"&",
"$",
"parameters",
")",
"{",
"$",
"orderBy",
"=",
"$",
"query",
"->",
"getOrderBy",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"orderBy",
")",
")",
"{",
... | Returns the ORDER BY clauses ready for inserting into a query.
@param SQLSelect $query The expression object to build from
@param array $parameters Out parameter for the resulting query parameters
@return string Completed order by part of statement | [
"Returns",
"the",
"ORDER",
"BY",
"clauses",
"ready",
"for",
"inserting",
"into",
"a",
"query",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBQueryBuilder.php#L279-L294 | train |
silverstripe/silverstripe-framework | src/ORM/Connect/DBQueryBuilder.php | DBQueryBuilder.buildGroupByFragment | public function buildGroupByFragment(SQLSelect $query, array &$parameters)
{
$groupBy = $query->getGroupBy();
if (empty($groupBy)) {
return '';
}
$nl = $this->getSeparator();
return "{$nl}GROUP BY " . implode(', ', $groupBy);
} | php | public function buildGroupByFragment(SQLSelect $query, array &$parameters)
{
$groupBy = $query->getGroupBy();
if (empty($groupBy)) {
return '';
}
$nl = $this->getSeparator();
return "{$nl}GROUP BY " . implode(', ', $groupBy);
} | [
"public",
"function",
"buildGroupByFragment",
"(",
"SQLSelect",
"$",
"query",
",",
"array",
"&",
"$",
"parameters",
")",
"{",
"$",
"groupBy",
"=",
"$",
"query",
"->",
"getGroupBy",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"groupBy",
")",
")",
"{",
... | Returns the GROUP BY clauses ready for inserting into a query.
@param SQLSelect $query The expression object to build from
@param array $parameters Out parameter for the resulting query parameters
@return string Completed group part of statement | [
"Returns",
"the",
"GROUP",
"BY",
"clauses",
"ready",
"for",
"inserting",
"into",
"a",
"query",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBQueryBuilder.php#L303-L312 | train |
silverstripe/silverstripe-framework | src/ORM/Connect/DBQueryBuilder.php | DBQueryBuilder.buildHavingFragment | public function buildHavingFragment(SQLSelect $query, array &$parameters)
{
$having = $query->getHavingParameterised($havingParameters);
if (empty($having)) {
return '';
}
// Generate having, considering parameters present
$connective = $query->getConnective();
... | php | public function buildHavingFragment(SQLSelect $query, array &$parameters)
{
$having = $query->getHavingParameterised($havingParameters);
if (empty($having)) {
return '';
}
// Generate having, considering parameters present
$connective = $query->getConnective();
... | [
"public",
"function",
"buildHavingFragment",
"(",
"SQLSelect",
"$",
"query",
",",
"array",
"&",
"$",
"parameters",
")",
"{",
"$",
"having",
"=",
"$",
"query",
"->",
"getHavingParameterised",
"(",
"$",
"havingParameters",
")",
";",
"if",
"(",
"empty",
"(",
... | Returns the HAVING clauses ready for inserting into a query.
@param SQLSelect $query The expression object to build from
@param array $parameters Out parameter for the resulting query parameters
@return string | [
"Returns",
"the",
"HAVING",
"clauses",
"ready",
"for",
"inserting",
"into",
"a",
"query",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBQueryBuilder.php#L321-L333 | train |
silverstripe/silverstripe-framework | src/ORM/Connect/DBQueryBuilder.php | DBQueryBuilder.buildLimitFragment | public function buildLimitFragment(SQLSelect $query, array &$parameters)
{
$nl = $this->getSeparator();
// Ensure limit is given
$limit = $query->getLimit();
if (empty($limit)) {
return '';
}
// For literal values return this as the limit SQL
if ... | php | public function buildLimitFragment(SQLSelect $query, array &$parameters)
{
$nl = $this->getSeparator();
// Ensure limit is given
$limit = $query->getLimit();
if (empty($limit)) {
return '';
}
// For literal values return this as the limit SQL
if ... | [
"public",
"function",
"buildLimitFragment",
"(",
"SQLSelect",
"$",
"query",
",",
"array",
"&",
"$",
"parameters",
")",
"{",
"$",
"nl",
"=",
"$",
"this",
"->",
"getSeparator",
"(",
")",
";",
"// Ensure limit is given",
"$",
"limit",
"=",
"$",
"query",
"->",... | Return the LIMIT clause ready for inserting into a query.
@param SQLSelect $query The expression object to build from
@param array $parameters Out parameter for the resulting query parameters
@return string The finalised limit SQL fragment | [
"Return",
"the",
"LIMIT",
"clause",
"ready",
"for",
"inserting",
"into",
"a",
"query",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/DBQueryBuilder.php#L342-L370 | train |
silverstripe/silverstripe-framework | src/Security/RequestAuthenticationHandler.php | RequestAuthenticationHandler.logIn | public function logIn(Member $member, $persistent = false, HTTPRequest $request = null)
{
$member->beforeMemberLoggedIn();
foreach ($this->getHandlers() as $handler) {
$handler->logIn($member, $persistent, $request);
}
Security::setCurrentUser($member);
$member-... | php | public function logIn(Member $member, $persistent = false, HTTPRequest $request = null)
{
$member->beforeMemberLoggedIn();
foreach ($this->getHandlers() as $handler) {
$handler->logIn($member, $persistent, $request);
}
Security::setCurrentUser($member);
$member-... | [
"public",
"function",
"logIn",
"(",
"Member",
"$",
"member",
",",
"$",
"persistent",
"=",
"false",
",",
"HTTPRequest",
"$",
"request",
"=",
"null",
")",
"{",
"$",
"member",
"->",
"beforeMemberLoggedIn",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
... | Log into the identity-store handlers attached to this request filter
@param Member $member
@param bool $persistent
@param HTTPRequest $request | [
"Log",
"into",
"the",
"identity",
"-",
"store",
"handlers",
"attached",
"to",
"this",
"request",
"filter"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/RequestAuthenticationHandler.php#L58-L68 | train |
silverstripe/silverstripe-framework | src/Security/RequestAuthenticationHandler.php | RequestAuthenticationHandler.logOut | public function logOut(HTTPRequest $request = null)
{
$member = Security::getCurrentUser();
if ($member) {
$member->beforeMemberLoggedOut($request);
}
foreach ($this->getHandlers() as $handler) {
$handler->logOut($request);
}
Security::setCur... | php | public function logOut(HTTPRequest $request = null)
{
$member = Security::getCurrentUser();
if ($member) {
$member->beforeMemberLoggedOut($request);
}
foreach ($this->getHandlers() as $handler) {
$handler->logOut($request);
}
Security::setCur... | [
"public",
"function",
"logOut",
"(",
"HTTPRequest",
"$",
"request",
"=",
"null",
")",
"{",
"$",
"member",
"=",
"Security",
"::",
"getCurrentUser",
"(",
")",
";",
"if",
"(",
"$",
"member",
")",
"{",
"$",
"member",
"->",
"beforeMemberLoggedOut",
"(",
"$",
... | Log out of all the identity-store handlers attached to this request filter
@param HTTPRequest $request | [
"Log",
"out",
"of",
"all",
"the",
"identity",
"-",
"store",
"handlers",
"attached",
"to",
"this",
"request",
"filter"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/RequestAuthenticationHandler.php#L75-L91 | train |
silverstripe/silverstripe-framework | src/Dev/CliDebugView.php | CliDebugView.renderError | public function renderError($httpRequest, $errno, $errstr, $errfile, $errline)
{
if (!isset(self::$error_types[$errno])) {
$errorTypeTitle = "UNKNOWN TYPE, ERRNO $errno";
} else {
$errorTypeTitle = self::$error_types[$errno]['title'];
}
$output = CLI::text("ER... | php | public function renderError($httpRequest, $errno, $errstr, $errfile, $errline)
{
if (!isset(self::$error_types[$errno])) {
$errorTypeTitle = "UNKNOWN TYPE, ERRNO $errno";
} else {
$errorTypeTitle = self::$error_types[$errno]['title'];
}
$output = CLI::text("ER... | [
"public",
"function",
"renderError",
"(",
"$",
"httpRequest",
",",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
",",
"$",
"errline",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"error_types",
"[",
"$",
"errno",
"]",
")",
")... | Write information about the error to the screen
@param string $httpRequest
@param int $errno
@param string $errstr
@param string $errfile
@param int $errline
@return string | [
"Write",
"information",
"about",
"the",
"error",
"to",
"the",
"screen"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/CliDebugView.php#L46-L57 | train |
silverstripe/silverstripe-framework | src/Dev/CliDebugView.php | CliDebugView.renderSourceFragment | public function renderSourceFragment($lines, $errline)
{
$output = "Source\n======\n";
foreach ($lines as $offset => $line) {
$output .= ($offset == $errline) ? "* " : " ";
$output .= str_pad("$offset:", 5);
$output .= wordwrap($line, self::config()->columns, "\n... | php | public function renderSourceFragment($lines, $errline)
{
$output = "Source\n======\n";
foreach ($lines as $offset => $line) {
$output .= ($offset == $errline) ? "* " : " ";
$output .= str_pad("$offset:", 5);
$output .= wordwrap($line, self::config()->columns, "\n... | [
"public",
"function",
"renderSourceFragment",
"(",
"$",
"lines",
",",
"$",
"errline",
")",
"{",
"$",
"output",
"=",
"\"Source\\n======\\n\"",
";",
"foreach",
"(",
"$",
"lines",
"as",
"$",
"offset",
"=>",
"$",
"line",
")",
"{",
"$",
"output",
".=",
"(",
... | Write a fragment of the a source file
@param array $lines An array of file lines; the keys should be the original line numbers
@param int $errline Index of the line in $lines which has the error
@return string | [
"Write",
"a",
"fragment",
"of",
"the",
"a",
"source",
"file"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/CliDebugView.php#L66-L77 | train |
silverstripe/silverstripe-framework | src/Dev/CliDebugView.php | CliDebugView.renderTrace | public function renderTrace($trace = null)
{
$output = "Trace\n=====\n";
$output .= Backtrace::get_rendered_backtrace($trace ? $trace : debug_backtrace(), true);
return $output;
} | php | public function renderTrace($trace = null)
{
$output = "Trace\n=====\n";
$output .= Backtrace::get_rendered_backtrace($trace ? $trace : debug_backtrace(), true);
return $output;
} | [
"public",
"function",
"renderTrace",
"(",
"$",
"trace",
"=",
"null",
")",
"{",
"$",
"output",
"=",
"\"Trace\\n=====\\n\"",
";",
"$",
"output",
".=",
"Backtrace",
"::",
"get_rendered_backtrace",
"(",
"$",
"trace",
"?",
"$",
"trace",
":",
"debug_backtrace",
"(... | Write a backtrace
@param array $trace
@return string | [
"Write",
"a",
"backtrace"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/CliDebugView.php#L85-L91 | train |
silverstripe/silverstripe-framework | src/Core/Manifest/VersionProvider.php | VersionProvider.getVersion | public function getVersion()
{
$modules = $this->getModules();
$lockModules = $this->getModuleVersionFromComposer(array_keys($modules));
$output = [];
foreach ($modules as $module => $title) {
$version = isset($lockModules[$module])
? $lockModules[$module]... | php | public function getVersion()
{
$modules = $this->getModules();
$lockModules = $this->getModuleVersionFromComposer(array_keys($modules));
$output = [];
foreach ($modules as $module => $title) {
$version = isset($lockModules[$module])
? $lockModules[$module]... | [
"public",
"function",
"getVersion",
"(",
")",
"{",
"$",
"modules",
"=",
"$",
"this",
"->",
"getModules",
"(",
")",
";",
"$",
"lockModules",
"=",
"$",
"this",
"->",
"getModuleVersionFromComposer",
"(",
"array_keys",
"(",
"$",
"modules",
")",
")",
";",
"$"... | Gets a comma delimited string of package titles and versions
@return string | [
"Gets",
"a",
"comma",
"delimited",
"string",
"of",
"package",
"titles",
"and",
"versions"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/Manifest/VersionProvider.php#L32-L44 | train |
silverstripe/silverstripe-framework | src/Core/Manifest/VersionProvider.php | VersionProvider.getModuleVersionFromComposer | public function getModuleVersionFromComposer($modules = [])
{
$versions = [];
$lockData = $this->getComposerLock();
if ($lockData && !empty($lockData['packages'])) {
foreach ($lockData['packages'] as $package) {
if (in_array($package['name'], $modules) && isset($p... | php | public function getModuleVersionFromComposer($modules = [])
{
$versions = [];
$lockData = $this->getComposerLock();
if ($lockData && !empty($lockData['packages'])) {
foreach ($lockData['packages'] as $package) {
if (in_array($package['name'], $modules) && isset($p... | [
"public",
"function",
"getModuleVersionFromComposer",
"(",
"$",
"modules",
"=",
"[",
"]",
")",
"{",
"$",
"versions",
"=",
"[",
"]",
";",
"$",
"lockData",
"=",
"$",
"this",
"->",
"getComposerLock",
"(",
")",
";",
"if",
"(",
"$",
"lockData",
"&&",
"!",
... | Tries to obtain version number from composer.lock if it exists
@param array $modules
@return array | [
"Tries",
"to",
"obtain",
"version",
"number",
"from",
"composer",
".",
"lock",
"if",
"it",
"exists"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/Manifest/VersionProvider.php#L64-L76 | train |
silverstripe/silverstripe-framework | src/Core/Manifest/VersionProvider.php | VersionProvider.getComposerLock | protected function getComposerLock($cache = true)
{
$composerLockPath = BASE_PATH . '/composer.lock';
if (!file_exists($composerLockPath)) {
return [];
}
$lockData = [];
$jsonData = file_get_contents($composerLockPath);
if ($cache) {
$cache =... | php | protected function getComposerLock($cache = true)
{
$composerLockPath = BASE_PATH . '/composer.lock';
if (!file_exists($composerLockPath)) {
return [];
}
$lockData = [];
$jsonData = file_get_contents($composerLockPath);
if ($cache) {
$cache =... | [
"protected",
"function",
"getComposerLock",
"(",
"$",
"cache",
"=",
"true",
")",
"{",
"$",
"composerLockPath",
"=",
"BASE_PATH",
".",
"'/composer.lock'",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"composerLockPath",
")",
")",
"{",
"return",
"[",
"]",
"... | Load composer.lock's contents and return it
@param bool $cache
@return array | [
"Load",
"composer",
".",
"lock",
"s",
"contents",
"and",
"return",
"it"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/Manifest/VersionProvider.php#L84-L111 | train |
silverstripe/silverstripe-framework | src/View/Parsers/Transliterator.php | Transliterator.toASCII | public function toASCII($source)
{
if (function_exists('iconv') && $this->config()->use_iconv) {
return $this->useIconv($source);
} else {
return $this->useStrTr($source);
}
} | php | public function toASCII($source)
{
if (function_exists('iconv') && $this->config()->use_iconv) {
return $this->useIconv($source);
} else {
return $this->useStrTr($source);
}
} | [
"public",
"function",
"toASCII",
"(",
"$",
"source",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'iconv'",
")",
"&&",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"use_iconv",
")",
"{",
"return",
"$",
"this",
"->",
"useIconv",
"(",
"$",
"source",
"... | Convert the given utf8 string to a safe ASCII source
@param string $source
@return string | [
"Convert",
"the",
"given",
"utf8",
"string",
"to",
"a",
"safe",
"ASCII",
"source"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Parsers/Transliterator.php#L36-L43 | train |
silverstripe/silverstripe-framework | src/Forms/FileUploadReceiver.php | FileUploadReceiver.getRelationAutosetClass | public function getRelationAutosetClass($default = File::class)
{
// Don't autodetermine relation if no relationship between parent record
if (!$this->getRelationAutoSetting()) {
return $default;
}
// Check record and name
$name = $this->getName();
$recor... | php | public function getRelationAutosetClass($default = File::class)
{
// Don't autodetermine relation if no relationship between parent record
if (!$this->getRelationAutoSetting()) {
return $default;
}
// Check record and name
$name = $this->getName();
$recor... | [
"public",
"function",
"getRelationAutosetClass",
"(",
"$",
"default",
"=",
"File",
"::",
"class",
")",
"{",
"// Don't autodetermine relation if no relationship between parent record",
"if",
"(",
"!",
"$",
"this",
"->",
"getRelationAutoSetting",
"(",
")",
")",
"{",
"re... | Gets the foreign class that needs to be created, or 'File' as default if there
is no relationship, or it cannot be determined.
@param string $default Default value to return if no value could be calculated
@return string Foreign class name. | [
"Gets",
"the",
"foreign",
"class",
"that",
"needs",
"to",
"be",
"created",
"or",
"File",
"as",
"default",
"if",
"there",
"is",
"no",
"relationship",
"or",
"it",
"cannot",
"be",
"determined",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/FileUploadReceiver.php#L351-L367 | train |
silverstripe/silverstripe-framework | src/Forms/FileUploadReceiver.php | FileUploadReceiver.extractUploadedFileData | protected function extractUploadedFileData($postVars)
{
// Note: Format of posted file parameters in php is a feature of using
// <input name='{$Name}[Uploads][]' /> for multiple file uploads
$tmpFiles = array();
if (!empty($postVars['tmp_name'])
&& is_array($postVars['tm... | php | protected function extractUploadedFileData($postVars)
{
// Note: Format of posted file parameters in php is a feature of using
// <input name='{$Name}[Uploads][]' /> for multiple file uploads
$tmpFiles = array();
if (!empty($postVars['tmp_name'])
&& is_array($postVars['tm... | [
"protected",
"function",
"extractUploadedFileData",
"(",
"$",
"postVars",
")",
"{",
"// Note: Format of posted file parameters in php is a feature of using",
"// <input name='{$Name}[Uploads][]' /> for multiple file uploads",
"$",
"tmpFiles",
"=",
"array",
"(",
")",
";",
"if",
"(... | Given an array of post variables, extract all temporary file data into an array
@param array $postVars Array of posted form data
@return array List of temporary file data | [
"Given",
"an",
"array",
"of",
"post",
"variables",
"extract",
"all",
"temporary",
"file",
"data",
"into",
"an",
"array"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/FileUploadReceiver.php#L397-L423 | train |
silverstripe/silverstripe-framework | src/ORM/Filters/FulltextFilter.php | FulltextFilter.prepareColumns | protected function prepareColumns($columns)
{
$prefix = DataQuery::applyRelationPrefix($this->relation);
$table = DataObject::getSchema()->tableForField($this->model, current($columns));
$fullTable = $prefix . $table;
$columns = array_map(function ($col) use ($fullTable) {
... | php | protected function prepareColumns($columns)
{
$prefix = DataQuery::applyRelationPrefix($this->relation);
$table = DataObject::getSchema()->tableForField($this->model, current($columns));
$fullTable = $prefix . $table;
$columns = array_map(function ($col) use ($fullTable) {
... | [
"protected",
"function",
"prepareColumns",
"(",
"$",
"columns",
")",
"{",
"$",
"prefix",
"=",
"DataQuery",
"::",
"applyRelationPrefix",
"(",
"$",
"this",
"->",
"relation",
")",
";",
"$",
"table",
"=",
"DataObject",
"::",
"getSchema",
"(",
")",
"->",
"table... | Adds table identifier to the every column.
Columns must have table identifier to prevent duplicate column name error.
@param array $columns
@return string | [
"Adds",
"table",
"identifier",
"to",
"the",
"every",
"column",
".",
"Columns",
"must",
"have",
"table",
"identifier",
"to",
"prevent",
"duplicate",
"column",
"name",
"error",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Filters/FulltextFilter.php#L92-L101 | train |
silverstripe/silverstripe-framework | src/Forms/TreeMultiselectField.php | TreeMultiselectField.getItems | public function getItems()
{
$items = new ArrayList();
// If the value has been set, use that
if ($this->value != 'unchanged') {
$sourceObject = $this->getSourceObject();
if (is_array($sourceObject)) {
$values = is_array($this->value) ? $this->value :... | php | public function getItems()
{
$items = new ArrayList();
// If the value has been set, use that
if ($this->value != 'unchanged') {
$sourceObject = $this->getSourceObject();
if (is_array($sourceObject)) {
$values = is_array($this->value) ? $this->value :... | [
"public",
"function",
"getItems",
"(",
")",
"{",
"$",
"items",
"=",
"new",
"ArrayList",
"(",
")",
";",
"// If the value has been set, use that",
"if",
"(",
"$",
"this",
"->",
"value",
"!=",
"'unchanged'",
")",
"{",
"$",
"sourceObject",
"=",
"$",
"this",
"-... | Return this field's linked items
@return ArrayList|DataList $items | [
"Return",
"this",
"field",
"s",
"linked",
"items"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/TreeMultiselectField.php#L120-L164 | train |
silverstripe/silverstripe-framework | src/Forms/TreeMultiselectField.php | TreeMultiselectField.Field | public function Field($properties = array())
{
$value = '';
$titleArray = array();
$idArray = array();
$items = $this->getItems();
$emptyTitle = _t('SilverStripe\\Forms\\DropdownField.CHOOSE', '(Choose)', 'start value of a dropdown');
if ($items && count($items)) {
... | php | public function Field($properties = array())
{
$value = '';
$titleArray = array();
$idArray = array();
$items = $this->getItems();
$emptyTitle = _t('SilverStripe\\Forms\\DropdownField.CHOOSE', '(Choose)', 'start value of a dropdown');
if ($items && count($items)) {
... | [
"public",
"function",
"Field",
"(",
"$",
"properties",
"=",
"array",
"(",
")",
")",
"{",
"$",
"value",
"=",
"''",
";",
"$",
"titleArray",
"=",
"array",
"(",
")",
";",
"$",
"idArray",
"=",
"array",
"(",
")",
";",
"$",
"items",
"=",
"$",
"this",
... | We overwrite the field attribute to add our hidden fields, as this
formfield can contain multiple values.
@param array $properties
@return DBHTMLText | [
"We",
"overwrite",
"the",
"field",
"attribute",
"to",
"add",
"our",
"hidden",
"fields",
"as",
"this",
"formfield",
"can",
"contain",
"multiple",
"values",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/TreeMultiselectField.php#L173-L213 | train |
silverstripe/silverstripe-framework | src/Forms/TreeMultiselectField.php | TreeMultiselectField.performReadonlyTransformation | public function performReadonlyTransformation()
{
/** @var TreeMultiselectField_Readonly $copy */
$copy = $this->castedCopy(TreeMultiselectField_Readonly::class);
$copy->setKeyField($this->getKeyField());
$copy->setLabelField($this->getLabelField());
$copy->setSourceObject($t... | php | public function performReadonlyTransformation()
{
/** @var TreeMultiselectField_Readonly $copy */
$copy = $this->castedCopy(TreeMultiselectField_Readonly::class);
$copy->setKeyField($this->getKeyField());
$copy->setLabelField($this->getLabelField());
$copy->setSourceObject($t... | [
"public",
"function",
"performReadonlyTransformation",
"(",
")",
"{",
"/** @var TreeMultiselectField_Readonly $copy */",
"$",
"copy",
"=",
"$",
"this",
"->",
"castedCopy",
"(",
"TreeMultiselectField_Readonly",
"::",
"class",
")",
";",
"$",
"copy",
"->",
"setKeyField",
... | Changes this field to the readonly field. | [
"Changes",
"this",
"field",
"to",
"the",
"readonly",
"field",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Forms/TreeMultiselectField.php#L260-L269 | train |
silverstripe/silverstripe-framework | src/ORM/ListDecorator.php | ListDecorator.setList | public function setList($list)
{
$this->list = $list;
$this->failover = $this->list;
return $this;
} | php | public function setList($list)
{
$this->list = $list;
$this->failover = $this->list;
return $this;
} | [
"public",
"function",
"setList",
"(",
"$",
"list",
")",
"{",
"$",
"this",
"->",
"list",
"=",
"$",
"list",
";",
"$",
"this",
"->",
"failover",
"=",
"$",
"this",
"->",
"list",
";",
"return",
"$",
"this",
";",
"}"
] | Set the list this decorator wraps around.
Useful for keeping a decorator/paginated list configuration intact while modifying
the underlying list.
@return SS_List | [
"Set",
"the",
"list",
"this",
"decorator",
"wraps",
"around",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/ListDecorator.php#L46-L51 | train |
silverstripe/silverstripe-framework | src/ORM/FieldType/DBMoney.php | DBMoney.getFormatter | public function getFormatter()
{
$locale = $this->getLocale();
$currency = $this->getCurrency();
if ($currency) {
$locale .= '@currency=' . $currency;
}
return NumberFormatter::create($locale, NumberFormatter::CURRENCY);
} | php | public function getFormatter()
{
$locale = $this->getLocale();
$currency = $this->getCurrency();
if ($currency) {
$locale .= '@currency=' . $currency;
}
return NumberFormatter::create($locale, NumberFormatter::CURRENCY);
} | [
"public",
"function",
"getFormatter",
"(",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"getLocale",
"(",
")",
";",
"$",
"currency",
"=",
"$",
"this",
"->",
"getCurrency",
"(",
")",
";",
"if",
"(",
"$",
"currency",
")",
"{",
"$",
"locale",
".="... | Get currency formatter
@return NumberFormatter | [
"Get",
"currency",
"formatter"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBMoney.php#L34-L42 | train |
silverstripe/silverstripe-framework | src/ORM/Search/SearchContext.php | SearchContext.getQuery | public function getQuery($searchParams, $sort = false, $limit = false, $existingQuery = null)
{
/** DataList $query */
$query = null;
if ($existingQuery) {
if (!($existingQuery instanceof DataList)) {
throw new InvalidArgumentException("existingQuery must be DataL... | php | public function getQuery($searchParams, $sort = false, $limit = false, $existingQuery = null)
{
/** DataList $query */
$query = null;
if ($existingQuery) {
if (!($existingQuery instanceof DataList)) {
throw new InvalidArgumentException("existingQuery must be DataL... | [
"public",
"function",
"getQuery",
"(",
"$",
"searchParams",
",",
"$",
"sort",
"=",
"false",
",",
"$",
"limit",
"=",
"false",
",",
"$",
"existingQuery",
"=",
"null",
")",
"{",
"/** DataList $query */",
"$",
"query",
"=",
"null",
";",
"if",
"(",
"$",
"ex... | Returns a SQL object representing the search context for the given
list of query parameters.
@param array $searchParams Map of search criteria, mostly taken from $_REQUEST.
If a filter is applied to a relationship in dot notation,
the parameter name should have the dots replaced with double underscores,
for example "C... | [
"Returns",
"a",
"SQL",
"object",
"representing",
"the",
"search",
"context",
"for",
"the",
"given",
"list",
"of",
"query",
"parameters",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Search/SearchContext.php#L146-L192 | train |
silverstripe/silverstripe-framework | src/ORM/Search/SearchContext.php | SearchContext.getResults | public function getResults($searchParams, $sort = false, $limit = false)
{
$searchParams = array_filter((array)$searchParams, array($this, 'clearEmptySearchFields'));
// getQuery actually returns a DataList
return $this->getQuery($searchParams, $sort, $limit);
} | php | public function getResults($searchParams, $sort = false, $limit = false)
{
$searchParams = array_filter((array)$searchParams, array($this, 'clearEmptySearchFields'));
// getQuery actually returns a DataList
return $this->getQuery($searchParams, $sort, $limit);
} | [
"public",
"function",
"getResults",
"(",
"$",
"searchParams",
",",
"$",
"sort",
"=",
"false",
",",
"$",
"limit",
"=",
"false",
")",
"{",
"$",
"searchParams",
"=",
"array_filter",
"(",
"(",
"array",
")",
"$",
"searchParams",
",",
"array",
"(",
"$",
"thi... | Returns a result set from the given search parameters.
@todo rearrange start and limit params to reflect DataObject
@param array $searchParams
@param array|bool|string $sort
@param array|bool|string $limit
@return DataList
@throws Exception | [
"Returns",
"a",
"result",
"set",
"from",
"the",
"given",
"search",
"parameters",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Search/SearchContext.php#L205-L211 | train |
silverstripe/silverstripe-framework | src/ORM/Search/SearchContext.php | SearchContext.getFilter | public function getFilter($name)
{
if (isset($this->filters[$name])) {
return $this->filters[$name];
} else {
return null;
}
} | php | public function getFilter($name)
{
if (isset($this->filters[$name])) {
return $this->filters[$name];
} else {
return null;
}
} | [
"public",
"function",
"getFilter",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"filters",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"filters",
"[",
"$",
"name",
"]",
";",
"}",
"else",
"{",
"r... | Accessor for the filter attached to a named field.
@param string $name
@return SearchFilter | [
"Accessor",
"for",
"the",
"filter",
"attached",
"to",
"a",
"named",
"field",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Search/SearchContext.php#L231-L238 | train |
silverstripe/silverstripe-framework | src/ORM/Search/SearchContext.php | SearchContext.setSearchParams | public function setSearchParams($searchParams)
{
// hack to work with $searchParams when it's an Object
if ($searchParams instanceof HTTPRequest) {
$this->searchParams = $searchParams->getVars();
} else {
$this->searchParams = $searchParams;
}
return $... | php | public function setSearchParams($searchParams)
{
// hack to work with $searchParams when it's an Object
if ($searchParams instanceof HTTPRequest) {
$this->searchParams = $searchParams->getVars();
} else {
$this->searchParams = $searchParams;
}
return $... | [
"public",
"function",
"setSearchParams",
"(",
"$",
"searchParams",
")",
"{",
"// hack to work with $searchParams when it's an Object",
"if",
"(",
"$",
"searchParams",
"instanceof",
"HTTPRequest",
")",
"{",
"$",
"this",
"->",
"searchParams",
"=",
"$",
"searchParams",
"... | Set search param values
@param array|HTTPRequest $searchParams
@return $this | [
"Set",
"search",
"param",
"values"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Search/SearchContext.php#L326-L335 | train |
silverstripe/silverstripe-framework | src/ORM/Search/SearchContext.php | SearchContext.getSummary | public function getSummary()
{
$list = ArrayList::create();
foreach ($this->searchParams as $searchField => $searchValue) {
if (empty($searchValue)) {
continue;
}
$filter = $this->getFilter($searchField);
if (!$filter) {
... | php | public function getSummary()
{
$list = ArrayList::create();
foreach ($this->searchParams as $searchField => $searchValue) {
if (empty($searchValue)) {
continue;
}
$filter = $this->getFilter($searchField);
if (!$filter) {
... | [
"public",
"function",
"getSummary",
"(",
")",
"{",
"$",
"list",
"=",
"ArrayList",
"::",
"create",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"searchParams",
"as",
"$",
"searchField",
"=>",
"$",
"searchValue",
")",
"{",
"if",
"(",
"empty",
"(",
... | Gets a list of what fields were searched and the values provided
for each field. Returns an ArrayList of ArrayData, suitable for
rendering on a template.
@return ArrayList | [
"Gets",
"a",
"list",
"of",
"what",
"fields",
"were",
"searched",
"and",
"the",
"values",
"provided",
"for",
"each",
"field",
".",
"Returns",
"an",
"ArrayList",
"of",
"ArrayData",
"suitable",
"for",
"rendering",
"on",
"a",
"template",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Search/SearchContext.php#L352-L390 | train |
silverstripe/silverstripe-framework | src/Security/BasicAuth.php | BasicAuth.requireLogin | public static function requireLogin(
HTTPRequest $request,
$realm,
$permissionCode = null,
$tryUsingSessionLogin = true
) {
if ((Director::is_cli() && static::config()->get('ignore_cli'))) {
return true;
}
$member = null;
try {
... | php | public static function requireLogin(
HTTPRequest $request,
$realm,
$permissionCode = null,
$tryUsingSessionLogin = true
) {
if ((Director::is_cli() && static::config()->get('ignore_cli'))) {
return true;
}
$member = null;
try {
... | [
"public",
"static",
"function",
"requireLogin",
"(",
"HTTPRequest",
"$",
"request",
",",
"$",
"realm",
",",
"$",
"permissionCode",
"=",
"null",
",",
"$",
"tryUsingSessionLogin",
"=",
"true",
")",
"{",
"if",
"(",
"(",
"Director",
"::",
"is_cli",
"(",
")",
... | Require basic authentication. Will request a username and password if none is given.
Used by {@link Controller::init()}.
@param HTTPRequest $request
@param string $realm
@param string|array $permissionCode Optional
@param boolean $tryUsingSessionLogin If true, then the method with authenticate against the
session l... | [
"Require",
"basic",
"authentication",
".",
"Will",
"request",
"a",
"username",
"and",
"password",
"if",
"none",
"is",
"given",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/BasicAuth.php#L81-L164 | train |
silverstripe/silverstripe-framework | src/Security/BasicAuth.php | BasicAuth.protect_entire_site | public static function protect_entire_site($protect = true, $code = self::AUTH_PERMISSION, $message = null)
{
static::config()
->set('entire_site_protected', $protect)
->set('entire_site_protected_code', $code);
if ($message) {
static::config()->set('entire_site_p... | php | public static function protect_entire_site($protect = true, $code = self::AUTH_PERMISSION, $message = null)
{
static::config()
->set('entire_site_protected', $protect)
->set('entire_site_protected_code', $code);
if ($message) {
static::config()->set('entire_site_p... | [
"public",
"static",
"function",
"protect_entire_site",
"(",
"$",
"protect",
"=",
"true",
",",
"$",
"code",
"=",
"self",
"::",
"AUTH_PERMISSION",
",",
"$",
"message",
"=",
"null",
")",
"{",
"static",
"::",
"config",
"(",
")",
"->",
"set",
"(",
"'entire_si... | Enable protection of the entire site with basic authentication.
This log-in uses the Member database for authentication, but doesn't interfere with the
regular log-in form. This can be useful for test sites, where you want to hide the site
away from prying eyes, but still be able to test the regular log-in features of... | [
"Enable",
"protection",
"of",
"the",
"entire",
"site",
"with",
"basic",
"authentication",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/BasicAuth.php#L184-L192 | train |
silverstripe/silverstripe-framework | src/ORM/FieldType/DBHTMLText.php | DBHTMLText.setWhitelist | public function setWhitelist($whitelist)
{
if (!is_array($whitelist)) {
$whitelist = preg_split('/\s*,\s*/', $whitelist);
}
$this->whitelist = $whitelist;
return $this;
} | php | public function setWhitelist($whitelist)
{
if (!is_array($whitelist)) {
$whitelist = preg_split('/\s*,\s*/', $whitelist);
}
$this->whitelist = $whitelist;
return $this;
} | [
"public",
"function",
"setWhitelist",
"(",
"$",
"whitelist",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"whitelist",
")",
")",
"{",
"$",
"whitelist",
"=",
"preg_split",
"(",
"'/\\s*,\\s*/'",
",",
"$",
"whitelist",
")",
";",
"}",
"$",
"this",
"->",... | Set list of html properties to whitelist
@param array $whitelist
@return $this | [
"Set",
"list",
"of",
"html",
"properties",
"to",
"whitelist"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBHTMLText.php#L91-L98 | train |
silverstripe/silverstripe-framework | src/ORM/FieldType/DBHTMLText.php | DBHTMLText.Plain | public function Plain()
{
// Preserve line breaks
$text = preg_replace('/\<br(\s*)?\/?\>/i', "\n", $this->RAW());
// Convert paragraph breaks to multi-lines
$text = preg_replace('/\<\/p\>/i', "\n\n", $text);
// Strip out HTML tags
$text = strip_tags($text);
... | php | public function Plain()
{
// Preserve line breaks
$text = preg_replace('/\<br(\s*)?\/?\>/i', "\n", $this->RAW());
// Convert paragraph breaks to multi-lines
$text = preg_replace('/\<\/p\>/i', "\n\n", $text);
// Strip out HTML tags
$text = strip_tags($text);
... | [
"public",
"function",
"Plain",
"(",
")",
"{",
"// Preserve line breaks",
"$",
"text",
"=",
"preg_replace",
"(",
"'/\\<br(\\s*)?\\/?\\>/i'",
",",
"\"\\n\"",
",",
"$",
"this",
"->",
"RAW",
"(",
")",
")",
";",
"// Convert paragraph breaks to multi-lines",
"$",
"text"... | Get plain-text version
@return string | [
"Get",
"plain",
"-",
"text",
"version"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/FieldType/DBHTMLText.php#L219-L235 | train |
silverstripe/silverstripe-framework | src/ORM/Connect/MySQLDatabase.php | MySQLDatabase.getTransactionManager | protected function getTransactionManager()
{
if (!$this->transactionManager) {
// PDOConnector providers this
if ($this->connector instanceof TransactionManager) {
$this->transactionManager = new NestedTransactionManager($this->connector);
// Direct databa... | php | protected function getTransactionManager()
{
if (!$this->transactionManager) {
// PDOConnector providers this
if ($this->connector instanceof TransactionManager) {
$this->transactionManager = new NestedTransactionManager($this->connector);
// Direct databa... | [
"protected",
"function",
"getTransactionManager",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"transactionManager",
")",
"{",
"// PDOConnector providers this",
"if",
"(",
"$",
"this",
"->",
"connector",
"instanceof",
"TransactionManager",
")",
"{",
"$",
"t... | Returns the TransactionManager to handle transactions for this database.
@return TransactionManager | [
"Returns",
"the",
"TransactionManager",
"to",
"handle",
"transactions",
"for",
"this",
"database",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/MySQLDatabase.php#L309-L321 | train |
silverstripe/silverstripe-framework | src/ORM/Connect/MySQLDatabase.php | MySQLDatabase.resetTransactionNesting | protected function resetTransactionNesting()
{
// Check whether to use a connector's built-in transaction methods
if ($this->connector instanceof TransactionalDBConnector) {
if ($this->transactionNesting > 0) {
$this->connector->transactionRollback();
}
... | php | protected function resetTransactionNesting()
{
// Check whether to use a connector's built-in transaction methods
if ($this->connector instanceof TransactionalDBConnector) {
if ($this->transactionNesting > 0) {
$this->connector->transactionRollback();
}
... | [
"protected",
"function",
"resetTransactionNesting",
"(",
")",
"{",
"// Check whether to use a connector's built-in transaction methods",
"if",
"(",
"$",
"this",
"->",
"connector",
"instanceof",
"TransactionalDBConnector",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"transacti... | In error condition, set transactionNesting to zero | [
"In",
"error",
"condition",
"set",
"transactionNesting",
"to",
"zero"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/MySQLDatabase.php#L366-L375 | train |
silverstripe/silverstripe-framework | src/ORM/Connect/MySQLDatabase.php | MySQLDatabase.inspectQuery | protected function inspectQuery($sql)
{
// Any DDL discards transactions.
// See https://dev.mysql.com/doc/internals/en/transactions-notes-on-ddl-and-normal-transaction.html
// on why we need to be over-eager
$isDDL = $this->getConnector()->isQueryDDL($sql);
if ($isDDL) {
... | php | protected function inspectQuery($sql)
{
// Any DDL discards transactions.
// See https://dev.mysql.com/doc/internals/en/transactions-notes-on-ddl-and-normal-transaction.html
// on why we need to be over-eager
$isDDL = $this->getConnector()->isQueryDDL($sql);
if ($isDDL) {
... | [
"protected",
"function",
"inspectQuery",
"(",
"$",
"sql",
")",
"{",
"// Any DDL discards transactions.",
"// See https://dev.mysql.com/doc/internals/en/transactions-notes-on-ddl-and-normal-transaction.html",
"// on why we need to be over-eager",
"$",
"isDDL",
"=",
"$",
"this",
"->",
... | Inspect a SQL query prior to execution
@param string $sql | [
"Inspect",
"a",
"SQL",
"query",
"prior",
"to",
"execution"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/MySQLDatabase.php#L394-L403 | train |
silverstripe/silverstripe-framework | src/ORM/Connect/MySQLDatabase.php | MySQLDatabase.clearTable | public function clearTable($table)
{
$this->query("DELETE FROM \"$table\"");
// Check if resetting the auto-increment is needed
$autoIncrement = $this->preparedQuery(
'SELECT "AUTO_INCREMENT" FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?',
... | php | public function clearTable($table)
{
$this->query("DELETE FROM \"$table\"");
// Check if resetting the auto-increment is needed
$autoIncrement = $this->preparedQuery(
'SELECT "AUTO_INCREMENT" FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?',
... | [
"public",
"function",
"clearTable",
"(",
"$",
"table",
")",
"{",
"$",
"this",
"->",
"query",
"(",
"\"DELETE FROM \\\"$table\\\"\"",
")",
";",
"// Check if resetting the auto-increment is needed",
"$",
"autoIncrement",
"=",
"$",
"this",
"->",
"preparedQuery",
"(",
"'... | Clear all data in a given table
@param string $table Name of table | [
"Clear",
"all",
"data",
"in",
"a",
"given",
"table"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Connect/MySQLDatabase.php#L532-L545 | train |
silverstripe/silverstripe-framework | src/Core/Manifest/ModuleResourceLoader.php | ModuleResourceLoader.resolveURL | public function resolveURL($resource)
{
// Skip blank resources
if (empty($resource)) {
return null;
}
// Resolve resource to reference
$resource = $this->resolveResource($resource);
// Resolve resource to url
/** @var ResourceURLGenerator $gener... | php | public function resolveURL($resource)
{
// Skip blank resources
if (empty($resource)) {
return null;
}
// Resolve resource to reference
$resource = $this->resolveResource($resource);
// Resolve resource to url
/** @var ResourceURLGenerator $gener... | [
"public",
"function",
"resolveURL",
"(",
"$",
"resource",
")",
"{",
"// Skip blank resources",
"if",
"(",
"empty",
"(",
"$",
"resource",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Resolve resource to reference",
"$",
"resource",
"=",
"$",
"this",
"->",
"... | Resolves resource specifier to the given url.
@param string $resource
@return string | [
"Resolves",
"resource",
"specifier",
"to",
"the",
"given",
"url",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/Manifest/ModuleResourceLoader.php#L43-L57 | train |
silverstripe/silverstripe-framework | src/Core/Manifest/ModuleResourceLoader.php | ModuleResourceLoader.resolveResource | public function resolveResource($resource)
{
// String of the form vendor/package:resource. Excludes "http://bla" as that's an absolute URL
if (!preg_match('#^ *(?<module>[^/: ]+/[^/: ]+) *: *(?<resource>[^ ]*)$#', $resource, $matches)) {
return $resource;
}
$module = $ma... | php | public function resolveResource($resource)
{
// String of the form vendor/package:resource. Excludes "http://bla" as that's an absolute URL
if (!preg_match('#^ *(?<module>[^/: ]+/[^/: ]+) *: *(?<resource>[^ ]*)$#', $resource, $matches)) {
return $resource;
}
$module = $ma... | [
"public",
"function",
"resolveResource",
"(",
"$",
"resource",
")",
"{",
"// String of the form vendor/package:resource. Excludes \"http://bla\" as that's an absolute URL",
"if",
"(",
"!",
"preg_match",
"(",
"'#^ *(?<module>[^/: ]+/[^/: ]+) *: *(?<resource>[^ ]*)$#'",
",",
"$",
"re... | Return module resource for the given path, if specified as one.
Returns the original resource otherwise.
@param string $resource
@return ModuleResource|string The resource, or input string if not a module resource | [
"Return",
"module",
"resource",
"for",
"the",
"given",
"path",
"if",
"specified",
"as",
"one",
".",
"Returns",
"the",
"original",
"resource",
"otherwise",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/Manifest/ModuleResourceLoader.php#L96-L111 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.create | public static function create(
$select = "*",
$from = array(),
$where = array(),
$orderby = array(),
$groupby = array(),
$having = array(),
$limit = array()
) {
return Injector::inst()->createWithArgs(__CLASS__, func_get_args());
} | php | public static function create(
$select = "*",
$from = array(),
$where = array(),
$orderby = array(),
$groupby = array(),
$having = array(),
$limit = array()
) {
return Injector::inst()->createWithArgs(__CLASS__, func_get_args());
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"select",
"=",
"\"*\"",
",",
"$",
"from",
"=",
"array",
"(",
")",
",",
"$",
"where",
"=",
"array",
"(",
")",
",",
"$",
"orderby",
"=",
"array",
"(",
")",
",",
"$",
"groupby",
"=",
"array",
"(",
... | Construct a new SQLSelect.
@param array|string $select An array of SELECT fields.
@param array|string $from An array of FROM clauses. The first one should be just the table name.
Each should be ANSI quoted.
@param array $where An array of WHERE clauses.
@param array $orderby An array ORDER BY clause.
@param array $gro... | [
"Construct",
"a",
"new",
"SQLSelect",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L79-L89 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.setSelect | public function setSelect($fields)
{
$this->select = array();
if (func_num_args() > 1) {
$fields = func_get_args();
} elseif (!is_array($fields)) {
$fields = array($fields);
}
return $this->addSelect($fields);
} | php | public function setSelect($fields)
{
$this->select = array();
if (func_num_args() > 1) {
$fields = func_get_args();
} elseif (!is_array($fields)) {
$fields = array($fields);
}
return $this->addSelect($fields);
} | [
"public",
"function",
"setSelect",
"(",
"$",
"fields",
")",
"{",
"$",
"this",
"->",
"select",
"=",
"array",
"(",
")",
";",
"if",
"(",
"func_num_args",
"(",
")",
">",
"1",
")",
"{",
"$",
"fields",
"=",
"func_get_args",
"(",
")",
";",
"}",
"elseif",
... | Set the list of columns to be selected by the query.
<code>
// pass fields to select as single parameter array
$query->setSelect(array('"Col1"', '"Col2"'))->setFrom('"MyTable"');
// pass fields to select as multiple parameters
$query->setSelect('"Col1"', '"Col2"')->setFrom('"MyTable"');
// Set a list of selected fie... | [
"Set",
"the",
"list",
"of",
"columns",
"to",
"be",
"selected",
"by",
"the",
"query",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L139-L148 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.addSelect | public function addSelect($fields)
{
if (func_num_args() > 1) {
$fields = func_get_args();
} elseif (!is_array($fields)) {
$fields = array($fields);
}
foreach ($fields as $idx => $field) {
$this->selectField($field, is_numeric($idx) ? null : $idx);... | php | public function addSelect($fields)
{
if (func_num_args() > 1) {
$fields = func_get_args();
} elseif (!is_array($fields)) {
$fields = array($fields);
}
foreach ($fields as $idx => $field) {
$this->selectField($field, is_numeric($idx) ? null : $idx);... | [
"public",
"function",
"addSelect",
"(",
"$",
"fields",
")",
"{",
"if",
"(",
"func_num_args",
"(",
")",
">",
"1",
")",
"{",
"$",
"fields",
"=",
"func_get_args",
"(",
")",
";",
"}",
"elseif",
"(",
"!",
"is_array",
"(",
"$",
"fields",
")",
")",
"{",
... | Add to the list of columns to be selected by the query.
@see setSelect for example usage
@param string|array $fields Field names should be ANSI SQL quoted. Array keys should be unquoted.
@return $this Self reference | [
"Add",
"to",
"the",
"list",
"of",
"columns",
"to",
"be",
"selected",
"by",
"the",
"query",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L158-L170 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.selectField | public function selectField($field, $alias = null)
{
if (!$alias) {
if (preg_match('/"([^"]+)"$/', $field, $matches)) {
$alias = $matches[1];
} else {
$alias = $field;
}
}
$this->select[$alias] = $field;
return $this... | php | public function selectField($field, $alias = null)
{
if (!$alias) {
if (preg_match('/"([^"]+)"$/', $field, $matches)) {
$alias = $matches[1];
} else {
$alias = $field;
}
}
$this->select[$alias] = $field;
return $this... | [
"public",
"function",
"selectField",
"(",
"$",
"field",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"alias",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/\"([^\"]+)\"$/'",
",",
"$",
"field",
",",
"$",
"matches",
")",
")",
"{",
"$",... | Select an additional field.
@param string $field The field to select (ansi quoted SQL identifier or statement)
@param string|null $alias The alias of that field (unquoted SQL identifier).
Defaults to the unquoted column name of the $field parameter.
@return $this Self reference | [
"Select",
"an",
"additional",
"field",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L180-L191 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.setLimit | public function setLimit($limit, $offset = 0)
{
if ((is_numeric($limit) && $limit < 0) || (is_numeric($offset) && $offset < 0)) {
throw new InvalidArgumentException("SQLSelect::setLimit() only takes positive values");
}
if ($limit === 0) {
Deprecation::notice(
... | php | public function setLimit($limit, $offset = 0)
{
if ((is_numeric($limit) && $limit < 0) || (is_numeric($offset) && $offset < 0)) {
throw new InvalidArgumentException("SQLSelect::setLimit() only takes positive values");
}
if ($limit === 0) {
Deprecation::notice(
... | [
"public",
"function",
"setLimit",
"(",
"$",
"limit",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"if",
"(",
"(",
"is_numeric",
"(",
"$",
"limit",
")",
"&&",
"$",
"limit",
"<",
"0",
")",
"||",
"(",
"is_numeric",
"(",
"$",
"offset",
")",
"&&",
"$",
"... | Pass LIMIT clause either as SQL snippet or in array format.
Internally, limit will always be stored as a map containing the keys 'start' and 'limit'
@param int|string|array|null $limit If passed as a string or array, assumes SQL escaped data.
Only applies for positive values.
@param int $offset
@throws InvalidArgument... | [
"Pass",
"LIMIT",
"clause",
"either",
"as",
"SQL",
"snippet",
"or",
"in",
"array",
"format",
".",
"Internally",
"limit",
"will",
"always",
"be",
"stored",
"as",
"a",
"map",
"containing",
"the",
"keys",
"start",
"and",
"limit"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L247-L287 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.setOrderBy | public function setOrderBy($clauses = null, $direction = null)
{
$this->orderby = array();
return $this->addOrderBy($clauses, $direction);
} | php | public function setOrderBy($clauses = null, $direction = null)
{
$this->orderby = array();
return $this->addOrderBy($clauses, $direction);
} | [
"public",
"function",
"setOrderBy",
"(",
"$",
"clauses",
"=",
"null",
",",
"$",
"direction",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"orderby",
"=",
"array",
"(",
")",
";",
"return",
"$",
"this",
"->",
"addOrderBy",
"(",
"$",
"clauses",
",",
"$",
... | Set ORDER BY clause either as SQL snippet or in array format.
@example $sql->setOrderBy("Column");
@example $sql->setOrderBy("Column DESC");
@example $sql->setOrderBy("Column DESC, ColumnTwo ASC");
@example $sql->setOrderBy("Column", "DESC");
@example $sql->setOrderBy(array("Column" => "ASC", "ColumnTwo" => "DESC"));
... | [
"Set",
"ORDER",
"BY",
"clause",
"either",
"as",
"SQL",
"snippet",
"or",
"in",
"array",
"format",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L303-L307 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.addOrderBy | public function addOrderBy($clauses = null, $direction = null)
{
if (empty($clauses)) {
return $this;
}
if (is_string($clauses)) {
if (strpos($clauses, "(") !== false) {
$sort = preg_split("/,(?![^()]*+\\))/", $clauses);
} else {
... | php | public function addOrderBy($clauses = null, $direction = null)
{
if (empty($clauses)) {
return $this;
}
if (is_string($clauses)) {
if (strpos($clauses, "(") !== false) {
$sort = preg_split("/,(?![^()]*+\\))/", $clauses);
} else {
... | [
"public",
"function",
"addOrderBy",
"(",
"$",
"clauses",
"=",
"null",
",",
"$",
"direction",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"clauses",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"clauses"... | Add ORDER BY clause either as SQL snippet or in array format.
@example $sql->addOrderBy("Column");
@example $sql->addOrderBy("Column DESC");
@example $sql->addOrderBy("Column DESC, ColumnTwo ASC");
@example $sql->addOrderBy("Column", "DESC");
@example $sql->addOrderBy(array("Column" => "ASC", "ColumnTwo" => "DESC"));
... | [
"Add",
"ORDER",
"BY",
"clause",
"either",
"as",
"SQL",
"snippet",
"or",
"in",
"array",
"format",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L322-L384 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.getDirectionFromString | private function getDirectionFromString($value, $defaultDirection = null)
{
if (preg_match('/^(.*)(asc|desc)$/i', $value, $matches)) {
$column = trim($matches[1]);
$direction = strtoupper($matches[2]);
} else {
$column = $value;
$direction = $defaultDi... | php | private function getDirectionFromString($value, $defaultDirection = null)
{
if (preg_match('/^(.*)(asc|desc)$/i', $value, $matches)) {
$column = trim($matches[1]);
$direction = strtoupper($matches[2]);
} else {
$column = $value;
$direction = $defaultDi... | [
"private",
"function",
"getDirectionFromString",
"(",
"$",
"value",
",",
"$",
"defaultDirection",
"=",
"null",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^(.*)(asc|desc)$/i'",
",",
"$",
"value",
",",
"$",
"matches",
")",
")",
"{",
"$",
"column",
"=",
"trim... | Extract the direction part of a single-column order by clause.
@param string $value
@param string $defaultDirection
@return array A two element array: array($column, $direction) | [
"Extract",
"the",
"direction",
"part",
"of",
"a",
"single",
"-",
"column",
"order",
"by",
"clause",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L393-L403 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.getOrderBy | public function getOrderBy()
{
$orderby = $this->orderby;
if (!$orderby) {
$orderby = array();
}
if (!is_array($orderby)) {
// spilt by any commas not within brackets
$orderby = preg_split('/,(?![^()]*+\\))/', $orderby);
}
foreach... | php | public function getOrderBy()
{
$orderby = $this->orderby;
if (!$orderby) {
$orderby = array();
}
if (!is_array($orderby)) {
// spilt by any commas not within brackets
$orderby = preg_split('/,(?![^()]*+\\))/', $orderby);
}
foreach... | [
"public",
"function",
"getOrderBy",
"(",
")",
"{",
"$",
"orderby",
"=",
"$",
"this",
"->",
"orderby",
";",
"if",
"(",
"!",
"$",
"orderby",
")",
"{",
"$",
"orderby",
"=",
"array",
"(",
")",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"orderby"... | Returns the current order by as array if not already. To handle legacy
statements which are stored as strings. Without clauses and directions,
convert the orderby clause to something readable.
@return array | [
"Returns",
"the",
"current",
"order",
"by",
"as",
"array",
"if",
"not",
"already",
".",
"To",
"handle",
"legacy",
"statements",
"which",
"are",
"stored",
"as",
"strings",
".",
"Without",
"clauses",
"and",
"directions",
"convert",
"the",
"orderby",
"clause",
... | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L412-L437 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.reverseOrderBy | public function reverseOrderBy()
{
$order = $this->getOrderBy();
$this->orderby = array();
foreach ($order as $clause => $dir) {
$dir = (strtoupper($dir) == 'DESC') ? 'ASC' : 'DESC';
$this->addOrderBy($clause, $dir);
}
return $this;
} | php | public function reverseOrderBy()
{
$order = $this->getOrderBy();
$this->orderby = array();
foreach ($order as $clause => $dir) {
$dir = (strtoupper($dir) == 'DESC') ? 'ASC' : 'DESC';
$this->addOrderBy($clause, $dir);
}
return $this;
} | [
"public",
"function",
"reverseOrderBy",
"(",
")",
"{",
"$",
"order",
"=",
"$",
"this",
"->",
"getOrderBy",
"(",
")",
";",
"$",
"this",
"->",
"orderby",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"order",
"as",
"$",
"clause",
"=>",
"$",
"dir"... | Reverses the order by clause by replacing ASC or DESC references in the
current order by with it's corollary.
@return $this Self reference | [
"Reverses",
"the",
"order",
"by",
"clause",
"by",
"replacing",
"ASC",
"or",
"DESC",
"references",
"in",
"the",
"current",
"order",
"by",
"with",
"it",
"s",
"corollary",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L445-L456 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.addGroupBy | public function addGroupBy($groupby)
{
if (is_array($groupby)) {
$this->groupby = array_merge($this->groupby, $groupby);
} elseif (!empty($groupby)) {
$this->groupby[] = $groupby;
}
return $this;
} | php | public function addGroupBy($groupby)
{
if (is_array($groupby)) {
$this->groupby = array_merge($this->groupby, $groupby);
} elseif (!empty($groupby)) {
$this->groupby[] = $groupby;
}
return $this;
} | [
"public",
"function",
"addGroupBy",
"(",
"$",
"groupby",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"groupby",
")",
")",
"{",
"$",
"this",
"->",
"groupby",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"groupby",
",",
"$",
"groupby",
")",
";",
"}",
"... | Add a GROUP BY clause.
@param string|array $groupby Escaped SQL statement
@return $this Self reference | [
"Add",
"a",
"GROUP",
"BY",
"clause",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L476-L485 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.setHaving | public function setHaving($having)
{
$having = func_num_args() > 1 ? func_get_args() : $having;
$this->having = array();
return $this->addHaving($having);
} | php | public function setHaving($having)
{
$having = func_num_args() > 1 ? func_get_args() : $having;
$this->having = array();
return $this->addHaving($having);
} | [
"public",
"function",
"setHaving",
"(",
"$",
"having",
")",
"{",
"$",
"having",
"=",
"func_num_args",
"(",
")",
">",
"1",
"?",
"func_get_args",
"(",
")",
":",
"$",
"having",
";",
"$",
"this",
"->",
"having",
"=",
"array",
"(",
")",
";",
"return",
"... | Set a HAVING clause.
@see SQLSelect::addWhere() for syntax examples
@param mixed $having Predicate(s) to set, as escaped SQL statements or parameterised queries
@param mixed $having,... Unlimited additional predicates
@return $this Self reference | [
"Set",
"a",
"HAVING",
"clause",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L496-L501 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.addHaving | public function addHaving($having)
{
$having = $this->normalisePredicates(func_get_args());
// If the function is called with an array of items
$this->having = array_merge($this->having, $having);
return $this;
} | php | public function addHaving($having)
{
$having = $this->normalisePredicates(func_get_args());
// If the function is called with an array of items
$this->having = array_merge($this->having, $having);
return $this;
} | [
"public",
"function",
"addHaving",
"(",
"$",
"having",
")",
"{",
"$",
"having",
"=",
"$",
"this",
"->",
"normalisePredicates",
"(",
"func_get_args",
"(",
")",
")",
";",
"// If the function is called with an array of items",
"$",
"this",
"->",
"having",
"=",
"arr... | Add a HAVING clause
@see SQLSelect::addWhere() for syntax examples
@param mixed $having Predicate(s) to set, as escaped SQL statements or parameterised queries
@param mixed $having,... Unlimited additional predicates
@return $this Self reference | [
"Add",
"a",
"HAVING",
"clause"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L512-L520 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.unlimitedRowCount | public function unlimitedRowCount($column = null)
{
// we can't clear the select if we're relying on its output by a HAVING clause
if (count($this->having)) {
$records = $this->execute();
return $records->numRecords();
}
$clone = clone $this;
$clone->... | php | public function unlimitedRowCount($column = null)
{
// we can't clear the select if we're relying on its output by a HAVING clause
if (count($this->having)) {
$records = $this->execute();
return $records->numRecords();
}
$clone = clone $this;
$clone->... | [
"public",
"function",
"unlimitedRowCount",
"(",
"$",
"column",
"=",
"null",
")",
"{",
"// we can't clear the select if we're relying on its output by a HAVING clause",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"having",
")",
")",
"{",
"$",
"records",
"=",
"$",
"... | Return the number of rows in this query if the limit were removed. Useful in paged data sets.
@param string $column
@return int | [
"Return",
"the",
"number",
"of",
"rows",
"in",
"this",
"query",
"if",
"the",
"limit",
"were",
"removed",
".",
"Useful",
"in",
"paged",
"data",
"sets",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L574-L605 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.count | public function count($column = null)
{
// we can't clear the select if we're relying on its output by a HAVING clause
if (!empty($this->having)) {
$records = $this->execute();
return $records->numRecords();
} elseif ($column == null) {
// Choose a default... | php | public function count($column = null)
{
// we can't clear the select if we're relying on its output by a HAVING clause
if (!empty($this->having)) {
$records = $this->execute();
return $records->numRecords();
} elseif ($column == null) {
// Choose a default... | [
"public",
"function",
"count",
"(",
"$",
"column",
"=",
"null",
")",
"{",
"// we can't clear the select if we're relying on its output by a HAVING clause",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"having",
")",
")",
"{",
"$",
"records",
"=",
"$",
"this"... | Return the number of rows in this query, respecting limit and offset.
@param string $column Quoted, escaped column name
@return int | [
"Return",
"the",
"number",
"of",
"rows",
"in",
"this",
"query",
"respecting",
"limit",
"and",
"offset",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L627-L661 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.aggregate | public function aggregate($column, $alias = null)
{
$clone = clone $this;
// don't set an ORDER BY clause if no limit has been set. It doesn't make
// sense to add an ORDER BY if there is no limit, and it will break
// queries to databases like MSSQL if you do so. Note that the rea... | php | public function aggregate($column, $alias = null)
{
$clone = clone $this;
// don't set an ORDER BY clause if no limit has been set. It doesn't make
// sense to add an ORDER BY if there is no limit, and it will break
// queries to databases like MSSQL if you do so. Note that the rea... | [
"public",
"function",
"aggregate",
"(",
"$",
"column",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"$",
"clone",
"=",
"clone",
"$",
"this",
";",
"// don't set an ORDER BY clause if no limit has been set. It doesn't make",
"// sense to add an ORDER BY if there is no limit, and... | Return a new SQLSelect that calls the given aggregate functions on this data.
@param string $column An aggregate expression, such as 'MAX("Balance")', or a set of them
(as an escaped SQL statement)
@param string $alias An optional alias for the aggregate column.
@return SQLSelect A clone of this object with the given ... | [
"Return",
"a",
"new",
"SQLSelect",
"that",
"calls",
"the",
"given",
"aggregate",
"functions",
"on",
"this",
"data",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L671-L697 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.firstRow | public function firstRow()
{
$query = clone $this;
$offset = $this->limit ? $this->limit['start'] : 0;
$query->setLimit(1, $offset);
return $query;
} | php | public function firstRow()
{
$query = clone $this;
$offset = $this->limit ? $this->limit['start'] : 0;
$query->setLimit(1, $offset);
return $query;
} | [
"public",
"function",
"firstRow",
"(",
")",
"{",
"$",
"query",
"=",
"clone",
"$",
"this",
";",
"$",
"offset",
"=",
"$",
"this",
"->",
"limit",
"?",
"$",
"this",
"->",
"limit",
"[",
"'start'",
"]",
":",
"0",
";",
"$",
"query",
"->",
"setLimit",
"(... | Returns a query that returns only the first row of this query
@return SQLSelect A clone of this object with the first row only | [
"Returns",
"a",
"query",
"that",
"returns",
"only",
"the",
"first",
"row",
"of",
"this",
"query"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L704-L710 | train |
silverstripe/silverstripe-framework | src/ORM/Queries/SQLSelect.php | SQLSelect.lastRow | public function lastRow()
{
$query = clone $this;
$offset = $this->limit ? $this->limit['start'] : 0;
// Limit index to start in case of empty results
$index = max($this->count() + $offset - 1, 0);
$query->setLimit(1, $index);
return $query;
} | php | public function lastRow()
{
$query = clone $this;
$offset = $this->limit ? $this->limit['start'] : 0;
// Limit index to start in case of empty results
$index = max($this->count() + $offset - 1, 0);
$query->setLimit(1, $index);
return $query;
} | [
"public",
"function",
"lastRow",
"(",
")",
"{",
"$",
"query",
"=",
"clone",
"$",
"this",
";",
"$",
"offset",
"=",
"$",
"this",
"->",
"limit",
"?",
"$",
"this",
"->",
"limit",
"[",
"'start'",
"]",
":",
"0",
";",
"// Limit index to start in case of empty r... | Returns a query that returns only the last row of this query
@return SQLSelect A clone of this object with the last row only | [
"Returns",
"a",
"query",
"that",
"returns",
"only",
"the",
"last",
"row",
"of",
"this",
"query"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/Queries/SQLSelect.php#L717-L726 | train |
silverstripe/silverstripe-framework | src/ORM/DatabaseAdmin.php | DatabaseAdmin.groupedDataClasses | public function groupedDataClasses()
{
// Get all root data objects
$allClasses = get_declared_classes();
$rootClasses = [];
foreach ($allClasses as $class) {
if (get_parent_class($class) == DataObject::class) {
$rootClasses[$class] = array();
... | php | public function groupedDataClasses()
{
// Get all root data objects
$allClasses = get_declared_classes();
$rootClasses = [];
foreach ($allClasses as $class) {
if (get_parent_class($class) == DataObject::class) {
$rootClasses[$class] = array();
... | [
"public",
"function",
"groupedDataClasses",
"(",
")",
"{",
"// Get all root data objects",
"$",
"allClasses",
"=",
"get_declared_classes",
"(",
")",
";",
"$",
"rootClasses",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"allClasses",
"as",
"$",
"class",
")",
"{",
... | Get the data classes, grouped by their root class
@return array Array of data classes, grouped by their root class | [
"Get",
"the",
"data",
"classes",
"grouped",
"by",
"their",
"root",
"class"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DatabaseAdmin.php#L90-L113 | train |
silverstripe/silverstripe-framework | src/ORM/DatabaseAdmin.php | DatabaseAdmin.getReturnURL | protected function getReturnURL()
{
$url = $this->request->getVar('returnURL');
// Check that this url is a site url
if (empty($url) || !Director::is_site_url($url)) {
return null;
}
// Convert to absolute URL
return Director::absoluteURL($url, true);
... | php | protected function getReturnURL()
{
$url = $this->request->getVar('returnURL');
// Check that this url is a site url
if (empty($url) || !Director::is_site_url($url)) {
return null;
}
// Convert to absolute URL
return Director::absoluteURL($url, true);
... | [
"protected",
"function",
"getReturnURL",
"(",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"request",
"->",
"getVar",
"(",
"'returnURL'",
")",
";",
"// Check that this url is a site url",
"if",
"(",
"empty",
"(",
"$",
"url",
")",
"||",
"!",
"Director",
":... | Gets the url to return to after build
@return string|null | [
"Gets",
"the",
"url",
"to",
"return",
"to",
"after",
"build"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DatabaseAdmin.php#L159-L170 | train |
silverstripe/silverstripe-framework | src/ORM/DatabaseAdmin.php | DatabaseAdmin.buildDefaults | public function buildDefaults()
{
$dataClasses = ClassInfo::subclassesFor(DataObject::class);
array_shift($dataClasses);
if (!Director::is_cli()) {
echo "<ul>";
}
foreach ($dataClasses as $dataClass) {
singleton($dataClass)->requireDefaultRecords();
... | php | public function buildDefaults()
{
$dataClasses = ClassInfo::subclassesFor(DataObject::class);
array_shift($dataClasses);
if (!Director::is_cli()) {
echo "<ul>";
}
foreach ($dataClasses as $dataClass) {
singleton($dataClass)->requireDefaultRecords();
... | [
"public",
"function",
"buildDefaults",
"(",
")",
"{",
"$",
"dataClasses",
"=",
"ClassInfo",
"::",
"subclassesFor",
"(",
"DataObject",
"::",
"class",
")",
";",
"array_shift",
"(",
"$",
"dataClasses",
")",
";",
"if",
"(",
"!",
"Director",
"::",
"is_cli",
"("... | Build the default data, calling requireDefaultRecords on all
DataObject classes | [
"Build",
"the",
"default",
"data",
"calling",
"requireDefaultRecords",
"on",
"all",
"DataObject",
"classes"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DatabaseAdmin.php#L176-L197 | train |
silverstripe/silverstripe-framework | src/ORM/DatabaseAdmin.php | DatabaseAdmin.lastBuilt | public static function lastBuilt()
{
$file = TEMP_PATH
. DIRECTORY_SEPARATOR
. 'database-last-generated-'
. str_replace(array('\\','/',':'), '.', Director::baseFolder());
if (file_exists($file)) {
return filemtime($file);
}
return null... | php | public static function lastBuilt()
{
$file = TEMP_PATH
. DIRECTORY_SEPARATOR
. 'database-last-generated-'
. str_replace(array('\\','/',':'), '.', Director::baseFolder());
if (file_exists($file)) {
return filemtime($file);
}
return null... | [
"public",
"static",
"function",
"lastBuilt",
"(",
")",
"{",
"$",
"file",
"=",
"TEMP_PATH",
".",
"DIRECTORY_SEPARATOR",
".",
"'database-last-generated-'",
".",
"str_replace",
"(",
"array",
"(",
"'\\\\'",
",",
"'/'",
",",
"':'",
")",
",",
"'.'",
",",
"Director... | Returns the timestamp of the time that the database was last built
@return string Returns the timestamp of the time that the database was
last built | [
"Returns",
"the",
"timestamp",
"of",
"the",
"time",
"that",
"the",
"database",
"was",
"last",
"built"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DatabaseAdmin.php#L205-L216 | train |
silverstripe/silverstripe-framework | src/ORM/DatabaseAdmin.php | DatabaseAdmin.getClassNameRemappingFields | protected function getClassNameRemappingFields()
{
$dataClasses = ClassInfo::getValidSubClasses(DataObject::class);
$schema = DataObject::getSchema();
$remapping = [];
foreach ($dataClasses as $className) {
$fieldSpecs = $schema->fieldSpecs($className);
forea... | php | protected function getClassNameRemappingFields()
{
$dataClasses = ClassInfo::getValidSubClasses(DataObject::class);
$schema = DataObject::getSchema();
$remapping = [];
foreach ($dataClasses as $className) {
$fieldSpecs = $schema->fieldSpecs($className);
forea... | [
"protected",
"function",
"getClassNameRemappingFields",
"(",
")",
"{",
"$",
"dataClasses",
"=",
"ClassInfo",
"::",
"getValidSubClasses",
"(",
"DataObject",
"::",
"class",
")",
";",
"$",
"schema",
"=",
"DataObject",
"::",
"getSchema",
"(",
")",
";",
"$",
"remap... | Find all DBClassName fields on valid subclasses of DataObject that should be remapped. This includes
`ClassName` fields as well as polymorphic class name fields.
@return array[] | [
"Find",
"all",
"DBClassName",
"fields",
"on",
"valid",
"subclasses",
"of",
"DataObject",
"that",
"should",
"be",
"remapped",
".",
"This",
"includes",
"ClassName",
"fields",
"as",
"well",
"as",
"polymorphic",
"class",
"name",
"fields",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DatabaseAdmin.php#L464-L480 | train |
silverstripe/silverstripe-framework | src/ORM/DatabaseAdmin.php | DatabaseAdmin.cleanup | public function cleanup()
{
$baseClasses = [];
foreach (ClassInfo::subclassesFor(DataObject::class) as $class) {
if (get_parent_class($class) == DataObject::class) {
$baseClasses[] = $class;
}
}
$schema = DataObject::getSchema();
forea... | php | public function cleanup()
{
$baseClasses = [];
foreach (ClassInfo::subclassesFor(DataObject::class) as $class) {
if (get_parent_class($class) == DataObject::class) {
$baseClasses[] = $class;
}
}
$schema = DataObject::getSchema();
forea... | [
"public",
"function",
"cleanup",
"(",
")",
"{",
"$",
"baseClasses",
"=",
"[",
"]",
";",
"foreach",
"(",
"ClassInfo",
"::",
"subclassesFor",
"(",
"DataObject",
"::",
"class",
")",
"as",
"$",
"class",
")",
"{",
"if",
"(",
"get_parent_class",
"(",
"$",
"c... | Remove invalid records from tables - that is, records that don't have
corresponding records in their parent class tables. | [
"Remove",
"invalid",
"records",
"from",
"tables",
"-",
"that",
"is",
"records",
"that",
"don",
"t",
"have",
"corresponding",
"records",
"in",
"their",
"parent",
"class",
"tables",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DatabaseAdmin.php#L486-L533 | train |
silverstripe/silverstripe-framework | src/Security/MemberAuthenticator/MemberLoginForm.php | MemberLoginForm.getFormFields | protected function getFormFields()
{
$request = $this->getRequest();
if ($request->getVar('BackURL')) {
$backURL = $request->getVar('BackURL');
} else {
$backURL = $request->getSession()->get('BackURL');
}
$label = Member::singleton()->fieldLabel(Memb... | php | protected function getFormFields()
{
$request = $this->getRequest();
if ($request->getVar('BackURL')) {
$backURL = $request->getVar('BackURL');
} else {
$backURL = $request->getSession()->get('BackURL');
}
$label = Member::singleton()->fieldLabel(Memb... | [
"protected",
"function",
"getFormFields",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"if",
"(",
"$",
"request",
"->",
"getVar",
"(",
"'BackURL'",
")",
")",
"{",
"$",
"backURL",
"=",
"$",
"request",
"->",
"getV... | Build the FieldList for the login form
@skipUpgrade
@return FieldList | [
"Build",
"the",
"FieldList",
"for",
"the",
"login",
"form"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/MemberAuthenticator/MemberLoginForm.php#L125-L173 | train |
silverstripe/silverstripe-framework | src/Security/MemberAuthenticator/MemberLoginForm.php | MemberLoginForm.getFormActions | protected function getFormActions()
{
$actions = FieldList::create(
FormAction::create('doLogin', _t('SilverStripe\\Security\\Member.BUTTONLOGIN', "Log in")),
LiteralField::create(
'forgotPassword',
'<p id="ForgotPassword"><a href="' . Security::lost_p... | php | protected function getFormActions()
{
$actions = FieldList::create(
FormAction::create('doLogin', _t('SilverStripe\\Security\\Member.BUTTONLOGIN', "Log in")),
LiteralField::create(
'forgotPassword',
'<p id="ForgotPassword"><a href="' . Security::lost_p... | [
"protected",
"function",
"getFormActions",
"(",
")",
"{",
"$",
"actions",
"=",
"FieldList",
"::",
"create",
"(",
"FormAction",
"::",
"create",
"(",
"'doLogin'",
",",
"_t",
"(",
"'SilverStripe\\\\Security\\\\Member.BUTTONLOGIN'",
",",
"\"Log in\"",
")",
")",
",",
... | Build default login form action FieldList
@return FieldList | [
"Build",
"default",
"login",
"form",
"action",
"FieldList"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Security/MemberAuthenticator/MemberLoginForm.php#L180-L192 | train |
silverstripe/silverstripe-framework | src/View/Embed/EmbedResource.php | EmbedResource.getName | public function getName()
{
if ($this->getEmbed()->title) {
return $this->getEmbed()->title;
}
return preg_replace('/\?.*/', '', basename($this->getEmbed()->getUrl()));
} | php | public function getName()
{
if ($this->getEmbed()->title) {
return $this->getEmbed()->title;
}
return preg_replace('/\?.*/', '', basename($this->getEmbed()->getUrl()));
} | [
"public",
"function",
"getName",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getEmbed",
"(",
")",
"->",
"title",
")",
"{",
"return",
"$",
"this",
"->",
"getEmbed",
"(",
")",
"->",
"title",
";",
"}",
"return",
"preg_replace",
"(",
"'/\\?.*/'",
",",
... | Get human readable name for this resource
@return string | [
"Get",
"human",
"readable",
"name",
"for",
"this",
"resource"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Embed/EmbedResource.php#L80-L87 | train |
silverstripe/silverstripe-framework | src/View/Embed/EmbedResource.php | EmbedResource.getEmbed | public function getEmbed()
{
if (!$this->embed) {
$this->embed = Embed::create($this->url, $this->getOptions(), $this->getDispatcher());
}
return $this->embed;
} | php | public function getEmbed()
{
if (!$this->embed) {
$this->embed = Embed::create($this->url, $this->getOptions(), $this->getDispatcher());
}
return $this->embed;
} | [
"public",
"function",
"getEmbed",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"embed",
")",
"{",
"$",
"this",
"->",
"embed",
"=",
"Embed",
"::",
"create",
"(",
"$",
"this",
"->",
"url",
",",
"$",
"this",
"->",
"getOptions",
"(",
")",
",",
... | Returns a bootstrapped Embed object
@return Adapter | [
"Returns",
"a",
"bootstrapped",
"Embed",
"object"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/Embed/EmbedResource.php#L140-L146 | train |
silverstripe/silverstripe-framework | src/Dev/TaskRunner.php | TaskRunner.runTask | public function runTask($request)
{
$name = $request->param('TaskName');
$tasks = $this->getTasks();
$title = function ($content) {
printf(Director::is_cli() ? "%s\n\n" : '<h1>%s</h1>', $content);
};
$message = function ($content) {
printf(Director::... | php | public function runTask($request)
{
$name = $request->param('TaskName');
$tasks = $this->getTasks();
$title = function ($content) {
printf(Director::is_cli() ? "%s\n\n" : '<h1>%s</h1>', $content);
};
$message = function ($content) {
printf(Director::... | [
"public",
"function",
"runTask",
"(",
"$",
"request",
")",
"{",
"$",
"name",
"=",
"$",
"request",
"->",
"param",
"(",
"'TaskName'",
")",
";",
"$",
"tasks",
"=",
"$",
"this",
"->",
"getTasks",
"(",
")",
";",
"$",
"title",
"=",
"function",
"(",
"$",
... | Runs a BuildTask
@param HTTPRequest $request | [
"Runs",
"a",
"BuildTask"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Dev/TaskRunner.php#L80-L110 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.setDataQueryParam | public function setDataQueryParam($keyOrArray, $val = null)
{
$clone = clone $this;
if (is_array($keyOrArray)) {
foreach ($keyOrArray as $key => $value) {
$clone->dataQuery->setQueryParam($key, $value);
}
} else {
$clone->dataQuery->setQue... | php | public function setDataQueryParam($keyOrArray, $val = null)
{
$clone = clone $this;
if (is_array($keyOrArray)) {
foreach ($keyOrArray as $key => $value) {
$clone->dataQuery->setQueryParam($key, $value);
}
} else {
$clone->dataQuery->setQue... | [
"public",
"function",
"setDataQueryParam",
"(",
"$",
"keyOrArray",
",",
"$",
"val",
"=",
"null",
")",
"{",
"$",
"clone",
"=",
"clone",
"$",
"this",
";",
"if",
"(",
"is_array",
"(",
"$",
"keyOrArray",
")",
")",
"{",
"foreach",
"(",
"$",
"keyOrArray",
... | Returns a new DataList instance with the specified query parameter assigned
@param string|array $keyOrArray Either the single key to set, or an array of key value pairs to set
@param mixed $val If $keyOrArray is not an array, this is the value to set
@return static | [
"Returns",
"a",
"new",
"DataList",
"instance",
"with",
"the",
"specified",
"query",
"parameter",
"assigned"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L168-L181 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.where | public function where($filter)
{
return $this->alterDataQuery(function (DataQuery $query) use ($filter) {
$query->where($filter);
});
} | php | public function where($filter)
{
return $this->alterDataQuery(function (DataQuery $query) use ($filter) {
$query->where($filter);
});
} | [
"public",
"function",
"where",
"(",
"$",
"filter",
")",
"{",
"return",
"$",
"this",
"->",
"alterDataQuery",
"(",
"function",
"(",
"DataQuery",
"$",
"query",
")",
"use",
"(",
"$",
"filter",
")",
"{",
"$",
"query",
"->",
"where",
"(",
"$",
"filter",
")... | Return a new DataList instance with a WHERE clause added to this list's query.
Supports parameterised queries.
See SQLSelect::addWhere() for syntax examples, although DataList
won't expand multiple method arguments as SQLSelect does.
@param string|array|SQLConditionGroup $filter Predicate(s) to set, as escaped SQL st... | [
"Return",
"a",
"new",
"DataList",
"instance",
"with",
"a",
"WHERE",
"clause",
"added",
"to",
"this",
"list",
"s",
"query",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L205-L210 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.whereAny | public function whereAny($filter)
{
return $this->alterDataQuery(function (DataQuery $query) use ($filter) {
$query->whereAny($filter);
});
} | php | public function whereAny($filter)
{
return $this->alterDataQuery(function (DataQuery $query) use ($filter) {
$query->whereAny($filter);
});
} | [
"public",
"function",
"whereAny",
"(",
"$",
"filter",
")",
"{",
"return",
"$",
"this",
"->",
"alterDataQuery",
"(",
"function",
"(",
"DataQuery",
"$",
"query",
")",
"use",
"(",
"$",
"filter",
")",
"{",
"$",
"query",
"->",
"whereAny",
"(",
"$",
"filter"... | Return a new DataList instance with a WHERE clause added to this list's query.
All conditions provided in the filter will be joined with an OR
Supports parameterised queries.
See SQLSelect::addWhere() for syntax examples, although DataList
won't expand multiple method arguments as SQLSelect does.
@param string|array|... | [
"Return",
"a",
"new",
"DataList",
"instance",
"with",
"a",
"WHERE",
"clause",
"added",
"to",
"this",
"list",
"s",
"query",
".",
"All",
"conditions",
"provided",
"in",
"the",
"filter",
"will",
"be",
"joined",
"with",
"an",
"OR"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L224-L229 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.canFilterBy | public function canFilterBy($fieldName)
{
$model = singleton($this->dataClass);
$relations = explode(".", $fieldName);
// First validate the relationships
$fieldName = array_pop($relations);
foreach ($relations as $r) {
$relationClass = $model->getRelationClass($r... | php | public function canFilterBy($fieldName)
{
$model = singleton($this->dataClass);
$relations = explode(".", $fieldName);
// First validate the relationships
$fieldName = array_pop($relations);
foreach ($relations as $r) {
$relationClass = $model->getRelationClass($r... | [
"public",
"function",
"canFilterBy",
"(",
"$",
"fieldName",
")",
"{",
"$",
"model",
"=",
"singleton",
"(",
"$",
"this",
"->",
"dataClass",
")",
";",
"$",
"relations",
"=",
"explode",
"(",
"\".\"",
",",
"$",
"fieldName",
")",
";",
"// First validate the rel... | Returns true if this DataList can be filtered by the given field.
@param string $fieldName (May be a related field in dot notation like Member.FirstName)
@return boolean | [
"Returns",
"true",
"if",
"this",
"DataList",
"can",
"be",
"filtered",
"by",
"the",
"given",
"field",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L250-L271 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.limit | public function limit($limit, $offset = 0)
{
return $this->alterDataQuery(function (DataQuery $query) use ($limit, $offset) {
$query->limit($limit, $offset);
});
} | php | public function limit($limit, $offset = 0)
{
return $this->alterDataQuery(function (DataQuery $query) use ($limit, $offset) {
$query->limit($limit, $offset);
});
} | [
"public",
"function",
"limit",
"(",
"$",
"limit",
",",
"$",
"offset",
"=",
"0",
")",
"{",
"return",
"$",
"this",
"->",
"alterDataQuery",
"(",
"function",
"(",
"DataQuery",
"$",
"query",
")",
"use",
"(",
"$",
"limit",
",",
"$",
"offset",
")",
"{",
"... | Return a new DataList instance with the records returned in this query
restricted by a limit clause.
@param int $limit
@param int $offset
@return static | [
"Return",
"a",
"new",
"DataList",
"instance",
"with",
"the",
"records",
"returned",
"in",
"this",
"query",
"restricted",
"by",
"a",
"limit",
"clause",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L281-L286 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.distinct | public function distinct($value)
{
return $this->alterDataQuery(function (DataQuery $query) use ($value) {
$query->distinct($value);
});
} | php | public function distinct($value)
{
return $this->alterDataQuery(function (DataQuery $query) use ($value) {
$query->distinct($value);
});
} | [
"public",
"function",
"distinct",
"(",
"$",
"value",
")",
"{",
"return",
"$",
"this",
"->",
"alterDataQuery",
"(",
"function",
"(",
"DataQuery",
"$",
"query",
")",
"use",
"(",
"$",
"value",
")",
"{",
"$",
"query",
"->",
"distinct",
"(",
"$",
"value",
... | Return a new DataList instance with distinct records or not
@param bool $value
@return static | [
"Return",
"a",
"new",
"DataList",
"instance",
"with",
"distinct",
"records",
"or",
"not"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L294-L299 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.sort | public function sort()
{
$count = func_num_args();
if ($count == 0) {
return $this;
}
if ($count > 2) {
throw new InvalidArgumentException('This method takes zero, one or two arguments');
}
if ($count == 2) {
$col = null;
... | php | public function sort()
{
$count = func_num_args();
if ($count == 0) {
return $this;
}
if ($count > 2) {
throw new InvalidArgumentException('This method takes zero, one or two arguments');
}
if ($count == 2) {
$col = null;
... | [
"public",
"function",
"sort",
"(",
")",
"{",
"$",
"count",
"=",
"func_num_args",
"(",
")",
";",
"if",
"(",
"$",
"count",
"==",
"0",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"$",
"count",
">",
"2",
")",
"{",
"throw",
"new",
"Invalid... | Return a new DataList instance as a copy of this data list with the sort
order set.
@see SS_List::sort()
@see SQLSelect::orderby
@example $list = $list->sort('Name'); // default ASC sorting
@example $list = $list->sort('Name DESC'); // DESC sorting
@example $list = $list->sort('Name', 'ASC');
@example $list = $list->s... | [
"Return",
"a",
"new",
"DataList",
"instance",
"as",
"a",
"copy",
"of",
"this",
"data",
"list",
"with",
"the",
"sort",
"order",
"set",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L315-L363 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.filter | public function filter()
{
// Validate and process arguments
$arguments = func_get_args();
switch (sizeof($arguments)) {
case 1:
$filters = $arguments[0];
break;
case 2:
$filters = [$arguments[0] => $arguments[1]];
... | php | public function filter()
{
// Validate and process arguments
$arguments = func_get_args();
switch (sizeof($arguments)) {
case 1:
$filters = $arguments[0];
break;
case 2:
$filters = [$arguments[0] => $arguments[1]];
... | [
"public",
"function",
"filter",
"(",
")",
"{",
"// Validate and process arguments",
"$",
"arguments",
"=",
"func_get_args",
"(",
")",
";",
"switch",
"(",
"sizeof",
"(",
"$",
"arguments",
")",
")",
"{",
"case",
"1",
":",
"$",
"filters",
"=",
"$",
"arguments... | Return a copy of this list which only includes items with these charactaristics
@see SS_List::filter()
@example $list = $list->filter('Name', 'bob'); // only bob in the list
@example $list = $list->filter('Name', array('aziz', 'bob'); // aziz and bob in list
@example $list = $list->filter(array('Name'=>'bob', 'Age'=>... | [
"Return",
"a",
"copy",
"of",
"this",
"list",
"which",
"only",
"includes",
"items",
"with",
"these",
"charactaristics"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L386-L404 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.addFilter | public function addFilter($filterArray)
{
$list = $this;
foreach ($filterArray as $expression => $value) {
$filter = $this->createSearchFilter($expression, $value);
$list = $list->alterDataQuery([$filter, 'apply']);
}
return $list;
} | php | public function addFilter($filterArray)
{
$list = $this;
foreach ($filterArray as $expression => $value) {
$filter = $this->createSearchFilter($expression, $value);
$list = $list->alterDataQuery([$filter, 'apply']);
}
return $list;
} | [
"public",
"function",
"addFilter",
"(",
"$",
"filterArray",
")",
"{",
"$",
"list",
"=",
"$",
"this",
";",
"foreach",
"(",
"$",
"filterArray",
"as",
"$",
"expression",
"=>",
"$",
"value",
")",
"{",
"$",
"filter",
"=",
"$",
"this",
"->",
"createSearchFil... | Return a new instance of the list with an added filter
@param array $filterArray
@return $this | [
"Return",
"a",
"new",
"instance",
"of",
"the",
"list",
"with",
"an",
"added",
"filter"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L412-L422 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.applyRelation | public function applyRelation($field, &$columnName = null, $linearOnly = false)
{
// If field is invalid, return it without modification
if (!$this->isValidRelationName($field)) {
$columnName = $field;
return $this;
}
// Simple fields without relations are ma... | php | public function applyRelation($field, &$columnName = null, $linearOnly = false)
{
// If field is invalid, return it without modification
if (!$this->isValidRelationName($field)) {
$columnName = $field;
return $this;
}
// Simple fields without relations are ma... | [
"public",
"function",
"applyRelation",
"(",
"$",
"field",
",",
"&",
"$",
"columnName",
"=",
"null",
",",
"$",
"linearOnly",
"=",
"false",
")",
"{",
"// If field is invalid, return it without modification",
"if",
"(",
"!",
"$",
"this",
"->",
"isValidRelationName",
... | Given a field or relation name, apply it safely to this datalist.
Unlike getRelationName, this is immutable and will fallback to the quoted field
name if not a relation.
@param string $field Name of field or relation to apply
@param string &$columnName Quoted column name
@param bool $linearOnly Set to true to restric... | [
"Given",
"a",
"field",
"or",
"relation",
"name",
"apply",
"it",
"safely",
"to",
"this",
"datalist",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L510-L538 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.exclude | public function exclude()
{
$numberFuncArgs = count(func_get_args());
$whereArguments = [];
if ($numberFuncArgs == 1 && is_array(func_get_arg(0))) {
$whereArguments = func_get_arg(0);
} elseif ($numberFuncArgs == 2) {
$whereArguments[func_get_arg(0)] = func_g... | php | public function exclude()
{
$numberFuncArgs = count(func_get_args());
$whereArguments = [];
if ($numberFuncArgs == 1 && is_array(func_get_arg(0))) {
$whereArguments = func_get_arg(0);
} elseif ($numberFuncArgs == 2) {
$whereArguments[func_get_arg(0)] = func_g... | [
"public",
"function",
"exclude",
"(",
")",
"{",
"$",
"numberFuncArgs",
"=",
"count",
"(",
"func_get_args",
"(",
")",
")",
";",
"$",
"whereArguments",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"numberFuncArgs",
"==",
"1",
"&&",
"is_array",
"(",
"func_get_arg",
... | Return a copy of this list which does not contain any items that match all params
@example $list = $list->exclude('Name', 'bob'); // exclude bob from list
@example $list = $list->exclude('Name', array('aziz', 'bob'); // exclude aziz and bob from list
@example $list = $list->exclude(array('Name'=>'bob, 'Age'=>21)); // ... | [
"Return",
"a",
"copy",
"of",
"this",
"list",
"which",
"does",
"not",
"contain",
"any",
"items",
"that",
"match",
"all",
"params"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L606-L627 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.excludeAny | public function excludeAny()
{
$numberFuncArgs = count(func_get_args());
$whereArguments = [];
if ($numberFuncArgs == 1 && is_array(func_get_arg(0))) {
$whereArguments = func_get_arg(0);
} elseif ($numberFuncArgs == 2) {
$whereArguments[func_get_arg(0)] = fun... | php | public function excludeAny()
{
$numberFuncArgs = count(func_get_args());
$whereArguments = [];
if ($numberFuncArgs == 1 && is_array(func_get_arg(0))) {
$whereArguments = func_get_arg(0);
} elseif ($numberFuncArgs == 2) {
$whereArguments[func_get_arg(0)] = fun... | [
"public",
"function",
"excludeAny",
"(",
")",
"{",
"$",
"numberFuncArgs",
"=",
"count",
"(",
"func_get_args",
"(",
")",
")",
";",
"$",
"whereArguments",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"numberFuncArgs",
"==",
"1",
"&&",
"is_array",
"(",
"func_get_arg... | Return a copy of this list which does not contain any items with any of these params
@example $list = $list->excludeAny('Name', 'bob'); // exclude bob from list
@example $list = $list->excludeAny('Name', array('aziz', 'bob'); // exclude aziz and bob from list
@example $list = $list->excludeAny(array('Name'=>'bob, 'Age... | [
"Return",
"a",
"copy",
"of",
"this",
"list",
"which",
"does",
"not",
"contain",
"any",
"items",
"with",
"any",
"of",
"these",
"params"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L644-L664 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.innerJoin | public function innerJoin($table, $onClause, $alias = null, $order = 20, $parameters = [])
{
return $this->alterDataQuery(function (DataQuery $query) use ($table, $onClause, $alias, $order, $parameters) {
$query->innerJoin($table, $onClause, $alias, $order, $parameters);
});
} | php | public function innerJoin($table, $onClause, $alias = null, $order = 20, $parameters = [])
{
return $this->alterDataQuery(function (DataQuery $query) use ($table, $onClause, $alias, $order, $parameters) {
$query->innerJoin($table, $onClause, $alias, $order, $parameters);
});
} | [
"public",
"function",
"innerJoin",
"(",
"$",
"table",
",",
"$",
"onClause",
",",
"$",
"alias",
"=",
"null",
",",
"$",
"order",
"=",
"20",
",",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"alterDataQuery",
"(",
"function",... | Return a new DataList instance with an inner join clause added to this list's query.
@param string $table Table name (unquoted and as escaped SQL)
@param string $onClause Escaped SQL statement, e.g. '"Table1"."ID" = "Table2"."ID"'
@param string $alias - if you want this table to be aliased under another name
@param in... | [
"Return",
"a",
"new",
"DataList",
"instance",
"with",
"an",
"inner",
"join",
"clause",
"added",
"to",
"this",
"list",
"s",
"query",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L698-L703 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.toArray | public function toArray()
{
$query = $this->dataQuery->query();
$rows = $query->execute();
$results = [];
foreach ($rows as $row) {
$results[] = $this->createDataObject($row);
}
return $results;
} | php | public function toArray()
{
$query = $this->dataQuery->query();
$rows = $query->execute();
$results = [];
foreach ($rows as $row) {
$results[] = $this->createDataObject($row);
}
return $results;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"dataQuery",
"->",
"query",
"(",
")",
";",
"$",
"rows",
"=",
"$",
"query",
"->",
"execute",
"(",
")",
";",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(",
... | Return an array of the actual items that this DataList contains at this stage.
This is when the query is actually executed.
@return array | [
"Return",
"an",
"array",
"of",
"the",
"actual",
"items",
"that",
"this",
"DataList",
"contains",
"at",
"this",
"stage",
".",
"This",
"is",
"when",
"the",
"query",
"is",
"actually",
"executed",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L730-L741 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.getGenerator | public function getGenerator()
{
$query = $this->dataQuery->query()->execute();
while ($row = $query->record()) {
yield $this->createDataObject($row);
}
} | php | public function getGenerator()
{
$query = $this->dataQuery->query()->execute();
while ($row = $query->record()) {
yield $this->createDataObject($row);
}
} | [
"public",
"function",
"getGenerator",
"(",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"dataQuery",
"->",
"query",
"(",
")",
"->",
"execute",
"(",
")",
";",
"while",
"(",
"$",
"row",
"=",
"$",
"query",
"->",
"record",
"(",
")",
")",
"{",
"yie... | Returns a generator for this DataList
@return \Generator&DataObject[] | [
"Returns",
"a",
"generator",
"for",
"this",
"DataList"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L779-L786 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.createDataObject | public function createDataObject($row)
{
$class = $this->dataClass;
if (empty($row['ClassName'])) {
$row['ClassName'] = $class;
}
// Failover from RecordClassName to ClassName
if (empty($row['RecordClassName'])) {
$row['RecordClassName'] = $row['Clas... | php | public function createDataObject($row)
{
$class = $this->dataClass;
if (empty($row['ClassName'])) {
$row['ClassName'] = $class;
}
// Failover from RecordClassName to ClassName
if (empty($row['RecordClassName'])) {
$row['RecordClassName'] = $row['Clas... | [
"public",
"function",
"createDataObject",
"(",
"$",
"row",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"dataClass",
";",
"if",
"(",
"empty",
"(",
"$",
"row",
"[",
"'ClassName'",
"]",
")",
")",
"{",
"$",
"row",
"[",
"'ClassName'",
"]",
"=",
"$",... | Create a DataObject from the given SQL row
@param array $row
@return DataObject | [
"Create",
"a",
"DataObject",
"from",
"the",
"given",
"SQL",
"row"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L816-L837 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.first | public function first()
{
foreach ($this->dataQuery->firstRow()->execute() as $row) {
return $this->createDataObject($row);
}
return null;
} | php | public function first()
{
foreach ($this->dataQuery->firstRow()->execute() as $row) {
return $this->createDataObject($row);
}
return null;
} | [
"public",
"function",
"first",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"dataQuery",
"->",
"firstRow",
"(",
")",
"->",
"execute",
"(",
")",
"as",
"$",
"row",
")",
"{",
"return",
"$",
"this",
"->",
"createDataObject",
"(",
"$",
"row",
")",
... | Returns the first item in this DataList
@return DataObject | [
"Returns",
"the",
"first",
"item",
"in",
"this",
"DataList"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L921-L927 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.last | public function last()
{
foreach ($this->dataQuery->lastRow()->execute() as $row) {
return $this->createDataObject($row);
}
return null;
} | php | public function last()
{
foreach ($this->dataQuery->lastRow()->execute() as $row) {
return $this->createDataObject($row);
}
return null;
} | [
"public",
"function",
"last",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"dataQuery",
"->",
"lastRow",
"(",
")",
"->",
"execute",
"(",
")",
"as",
"$",
"row",
")",
"{",
"return",
"$",
"this",
"->",
"createDataObject",
"(",
"$",
"row",
")",
";... | Returns the last item in this DataList
@return DataObject | [
"Returns",
"the",
"last",
"item",
"in",
"this",
"DataList"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L934-L940 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.setQueriedColumns | public function setQueriedColumns($queriedColumns)
{
return $this->alterDataQuery(function (DataQuery $query) use ($queriedColumns) {
$query->setQueriedColumns($queriedColumns);
});
} | php | public function setQueriedColumns($queriedColumns)
{
return $this->alterDataQuery(function (DataQuery $query) use ($queriedColumns) {
$query->setQueriedColumns($queriedColumns);
});
} | [
"public",
"function",
"setQueriedColumns",
"(",
"$",
"queriedColumns",
")",
"{",
"return",
"$",
"this",
"->",
"alterDataQuery",
"(",
"function",
"(",
"DataQuery",
"$",
"query",
")",
"use",
"(",
"$",
"queriedColumns",
")",
"{",
"$",
"query",
"->",
"setQueried... | Restrict the columns to fetch into this DataList
@param array $queriedColumns
@return static | [
"Restrict",
"the",
"columns",
"to",
"fetch",
"into",
"this",
"DataList"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L970-L975 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.setByIDList | public function setByIDList($idList)
{
$has = [];
// Index current data
foreach ($this->column() as $id) {
$has[$id] = true;
}
// Keep track of items to delete
$itemsToDelete = $has;
// add items in the list
// $id is the database ID of ... | php | public function setByIDList($idList)
{
$has = [];
// Index current data
foreach ($this->column() as $id) {
$has[$id] = true;
}
// Keep track of items to delete
$itemsToDelete = $has;
// add items in the list
// $id is the database ID of ... | [
"public",
"function",
"setByIDList",
"(",
"$",
"idList",
")",
"{",
"$",
"has",
"=",
"[",
"]",
";",
"// Index current data",
"foreach",
"(",
"$",
"this",
"->",
"column",
"(",
")",
"as",
"$",
"id",
")",
"{",
"$",
"has",
"[",
"$",
"id",
"]",
"=",
"t... | Sets the ComponentSet to be the given ID list.
Records will be added and deleted as appropriate.
@param array $idList List of IDs. | [
"Sets",
"the",
"ComponentSet",
"to",
"be",
"the",
"given",
"ID",
"list",
".",
"Records",
"will",
"be",
"added",
"and",
"deleted",
"as",
"appropriate",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L1029-L1054 | train |
silverstripe/silverstripe-framework | src/ORM/DataList.php | DataList.newObject | public function newObject($initialFields = null)
{
$class = $this->dataClass;
return Injector::inst()->create($class, $initialFields, false);
} | php | public function newObject($initialFields = null)
{
$class = $this->dataClass;
return Injector::inst()->create($class, $initialFields, false);
} | [
"public",
"function",
"newObject",
"(",
"$",
"initialFields",
"=",
"null",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"dataClass",
";",
"return",
"Injector",
"::",
"inst",
"(",
")",
"->",
"create",
"(",
"$",
"class",
",",
"$",
"initialFields",
","... | Return a new item to add to this DataList.
@todo This doesn't factor in filters.
@param array $initialFields
@return DataObject | [
"Return",
"a",
"new",
"item",
"to",
"add",
"to",
"this",
"DataList",
"."
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/ORM/DataList.php#L1168-L1172 | train |
silverstripe/silverstripe-framework | src/Core/Injector/SilverStripeServiceConfigurationLocator.php | SilverStripeServiceConfigurationLocator.configFor | protected function configFor($name)
{
// Return cached result
if (array_key_exists($name, $this->configs)) {
return $this->configs[$name];
}
$config = Config::inst()->get(Injector::class, $name);
$this->configs[$name] = $config;
return $config;
} | php | protected function configFor($name)
{
// Return cached result
if (array_key_exists($name, $this->configs)) {
return $this->configs[$name];
}
$config = Config::inst()->get(Injector::class, $name);
$this->configs[$name] = $config;
return $config;
} | [
"protected",
"function",
"configFor",
"(",
"$",
"name",
")",
"{",
"// Return cached result",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"configs",
")",
")",
"{",
"return",
"$",
"this",
"->",
"configs",
"[",
"$",
"name",
"]",... | Retrieves the config for a named service without performing a hierarchy walk
@param string $name Name of service
@return mixed Get config for this service | [
"Retrieves",
"the",
"config",
"for",
"a",
"named",
"service",
"without",
"performing",
"a",
"hierarchy",
"walk"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/Core/Injector/SilverStripeServiceConfigurationLocator.php#L47-L57 | train |
silverstripe/silverstripe-framework | src/View/SSViewer.php | SSViewer.fromString | public static function fromString($content, $cacheTemplate = null)
{
$viewer = SSViewer_FromString::create($content);
if ($cacheTemplate !== null) {
$viewer->setCacheTemplate($cacheTemplate);
}
return $viewer;
} | php | public static function fromString($content, $cacheTemplate = null)
{
$viewer = SSViewer_FromString::create($content);
if ($cacheTemplate !== null) {
$viewer->setCacheTemplate($cacheTemplate);
}
return $viewer;
} | [
"public",
"static",
"function",
"fromString",
"(",
"$",
"content",
",",
"$",
"cacheTemplate",
"=",
"null",
")",
"{",
"$",
"viewer",
"=",
"SSViewer_FromString",
"::",
"create",
"(",
"$",
"content",
")",
";",
"if",
"(",
"$",
"cacheTemplate",
"!==",
"null",
... | Create a template from a string instead of a .ss file
@param string $content The template content
@param bool|void $cacheTemplate Whether or not to cache the template from string
@return SSViewer | [
"Create",
"a",
"template",
"from",
"a",
"string",
"instead",
"of",
"a",
".",
"ss",
"file"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/SSViewer.php#L235-L242 | train |
silverstripe/silverstripe-framework | src/View/SSViewer.php | SSViewer.add_themes | public static function add_themes($themes = [])
{
$currentThemes = SSViewer::get_themes();
$finalThemes = array_merge($themes, $currentThemes);
// array_values is used to ensure sequential array keys as array_unique can leave gaps
static::set_themes(array_values(array_unique($finalTh... | php | public static function add_themes($themes = [])
{
$currentThemes = SSViewer::get_themes();
$finalThemes = array_merge($themes, $currentThemes);
// array_values is used to ensure sequential array keys as array_unique can leave gaps
static::set_themes(array_values(array_unique($finalTh... | [
"public",
"static",
"function",
"add_themes",
"(",
"$",
"themes",
"=",
"[",
"]",
")",
"{",
"$",
"currentThemes",
"=",
"SSViewer",
"::",
"get_themes",
"(",
")",
";",
"$",
"finalThemes",
"=",
"array_merge",
"(",
"$",
"themes",
",",
"$",
"currentThemes",
")... | Add to the list of active themes to apply
@param array $themes | [
"Add",
"to",
"the",
"list",
"of",
"active",
"themes",
"to",
"apply"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/SSViewer.php#L260-L266 | train |
silverstripe/silverstripe-framework | src/View/SSViewer.php | SSViewer.get_themes | public static function get_themes()
{
$default = [self::PUBLIC_THEME, self::DEFAULT_THEME];
if (!SSViewer::config()->uninherited('theme_enabled')) {
return $default;
}
// Explicit list is assigned
$themes = static::$current_themes;
if (!isset($themes)) {... | php | public static function get_themes()
{
$default = [self::PUBLIC_THEME, self::DEFAULT_THEME];
if (!SSViewer::config()->uninherited('theme_enabled')) {
return $default;
}
// Explicit list is assigned
$themes = static::$current_themes;
if (!isset($themes)) {... | [
"public",
"static",
"function",
"get_themes",
"(",
")",
"{",
"$",
"default",
"=",
"[",
"self",
"::",
"PUBLIC_THEME",
",",
"self",
"::",
"DEFAULT_THEME",
"]",
";",
"if",
"(",
"!",
"SSViewer",
"::",
"config",
"(",
")",
"->",
"uninherited",
"(",
"'theme_ena... | Get the list of active themes
@return array | [
"Get",
"the",
"list",
"of",
"active",
"themes"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/SSViewer.php#L273-L296 | train |
silverstripe/silverstripe-framework | src/View/SSViewer.php | SSViewer.getParser | public function getParser()
{
if (!$this->parser) {
$this->setParser(Injector::inst()->get('SilverStripe\\View\\SSTemplateParser'));
}
return $this->parser;
} | php | public function getParser()
{
if (!$this->parser) {
$this->setParser(Injector::inst()->get('SilverStripe\\View\\SSTemplateParser'));
}
return $this->parser;
} | [
"public",
"function",
"getParser",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"parser",
")",
"{",
"$",
"this",
"->",
"setParser",
"(",
"Injector",
"::",
"inst",
"(",
")",
"->",
"get",
"(",
"'SilverStripe\\\\View\\\\SSTemplateParser'",
")",
")",
";... | Returns the parser that is set for template generation
@return TemplateParser | [
"Returns",
"the",
"parser",
"that",
"is",
"set",
"for",
"template",
"generation"
] | ed7aaff7da61eefa172fe213ec25e35d2568bc20 | https://github.com/silverstripe/silverstripe-framework/blob/ed7aaff7da61eefa172fe213ec25e35d2568bc20/src/View/SSViewer.php#L448-L454 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.