query stringlengths 7 5.25k | document stringlengths 15 1.06M | metadata dict | negatives listlengths 3 101 | negative_scores listlengths 3 101 | document_score stringlengths 3 10 | document_rank stringclasses 102 values |
|---|---|---|---|---|---|---|
Inserts a record into the table | function insert_lost_record($dbc, $owner, $item_name, $description, $location_id, $create_date) {
$query = 'INSERT INTO stuff(owner, item_name, description, location_id, create_date, status) VALUES ("'.$owner.'" ,"'.$item_name.'", "'.$description.'", "'.$location_id.'", "'.$create_date.'", "lost")' ;
show_query($query);
$results = mysqli_query($dbc,$query) ;
check_results($results) ;
return $results ;
echo '<p> Your submission was successful!</p>' ;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"abstract public function insertRecord($tableName, $record);",
"public function insert(Table $table, $row);",
"public function recInsert($record) {\n $conn = Query::connect();\n $col = $conn->SelectLimit(\"select*from \".static::getTable(),1);\n $sql = $conn->GetInsertSQL($col,$record);\n ... | [
"0.78984356",
"0.74705034",
"0.7403592",
"0.7301942",
"0.7154372",
"0.7112254",
"0.7103371",
"0.7083447",
"0.70695686",
"0.7068472",
"0.70225275",
"0.69812053",
"0.69622415",
"0.68464524",
"0.6822168",
"0.681903",
"0.6818677",
"0.6818054",
"0.67984444",
"0.67654705",
"0.67509... | 0.0 | -1 |
Inserts a record into the table | function insert_found_record($dbc, $finder, $item_name, $description, $location_id, $create_date) {
$query = 'INSERT INTO stuff(finder, item_name, description, location_id, create_date, status) VALUES ("'.$finder.'" ,"'.$item_name.'", "'.$description.'", "'.$location_id.'", "'.$create_date.'", "found")' ;
show_query($query);
$results = mysqli_query($dbc,$query) ;
check_results($results) ;
return $results ;
echo '<p> Your submission was successful!</p>' ;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"abstract public function insertRecord($tableName, $record);",
"public function insert(Table $table, $row);",
"public function recInsert($record) {\n $conn = Query::connect();\n $col = $conn->SelectLimit(\"select*from \".static::getTable(),1);\n $sql = $conn->GetInsertSQL($col,$record);\n ... | [
"0.78974277",
"0.74703366",
"0.7402349",
"0.7302107",
"0.71543866",
"0.71121573",
"0.71034884",
"0.70842546",
"0.70713955",
"0.7069186",
"0.7022582",
"0.6983445",
"0.69637316",
"0.6847769",
"0.68232733",
"0.6820071",
"0.6819381",
"0.6818864",
"0.68003005",
"0.6767687",
"0.675... | 0.0 | -1 |
Inserts a record into the table | function update_record($dbc, $id, $item_name, $description, $location_id, $owner, $finder, $status) {
$query = 'UPDATE stuff set id = '.$id.', set item_name = '.$item_name.', set description = '.$description.', set location_id = '.$location_id.', set create_date= '.$create_date.' , set owner= '.$owner.', set finder = '.$finder.', set status = '.$status.')' ;
show_query($query);
$results = mysqli_query($dbc,$query) ;
check_results($results) ;
return $results ;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"abstract public function insertRecord($tableName, $record);",
"public function insert(Table $table, $row);",
"public function recInsert($record) {\n $conn = Query::connect();\n $col = $conn->SelectLimit(\"select*from \".static::getTable(),1);\n $sql = $conn->GetInsertSQL($col,$record);\n ... | [
"0.7899873",
"0.7470078",
"0.7404757",
"0.7302594",
"0.7154302",
"0.7112037",
"0.710335",
"0.7082816",
"0.7069187",
"0.706869",
"0.7021093",
"0.69806176",
"0.6961343",
"0.6846074",
"0.68228096",
"0.6819647",
"0.6817881",
"0.6817588",
"0.6798459",
"0.67644715",
"0.675085",
"... | 0.0 | -1 |
Inserts a record into the table | function insert_admin_record($dbc, $finder, $item_name, $description, $location_id, $create_date) {
$query = 'INSERT INTO stuff(finder, item_name, description, location_id, create_date, status) VALUES ("'.$finder.'" ,"'.$item_name.'", "'.$description.'", "'.$location_id.'", "'.$create_date.'", "found")' ;
show_query($query);
$results = mysqli_query($dbc,$query) ;
check_results($results) ;
return $results ;
echo '<p> Your submission was successful!</p>' ;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"abstract public function insertRecord($tableName, $record);",
"public function insert(Table $table, $row);",
"public function recInsert($record) {\n $conn = Query::connect();\n $col = $conn->SelectLimit(\"select*from \".static::getTable(),1);\n $sql = $conn->GetInsertSQL($col,$record);\n ... | [
"0.78984356",
"0.74705034",
"0.7403592",
"0.7301942",
"0.7154372",
"0.7112254",
"0.7103371",
"0.7083447",
"0.70695686",
"0.7068472",
"0.70225275",
"0.69812053",
"0.69622415",
"0.68464524",
"0.6822168",
"0.681903",
"0.6818677",
"0.6818054",
"0.67984444",
"0.67654705",
"0.67509... | 0.0 | -1 |
Create a query to get the name and price sorted by price | function show_link_records($dbc) {
$query = 'SELECT id, item_name, create_date, status FROM stuff' ;
# Execute the query
$results = mysqli_query( $dbc , $query ) ;
check_results($results);
# Show results
if ( $results )
{
# Initializes the table before executing the query
echo '<H1 align="center"></H1>';
echo '<TABLE align="center" cellpadding=10px cellspacing=5px border = "2">';
echo '<TR>';
echo '<TH>ID</TH>' ;
echo '<TH>Item Name</TH>';
echo '<TH>Created</TH>';
echo '<TH>Updated</TH>';
echo '<TH>Status</TH>';
echo '</TR>';
# For each row result, generate a table row
while ( $row = mysqli_fetch_array( $results, MYSQLI_ASSOC ) )
{
echo '<TR>' ;
echo '<TD>' . $row['id'] . '</TD>' ;
$alink = '<A HREF=quickdetail.php?id='. $row['id'] . '>' . $row['item_name'] . '</A>' ;
echo '<TD align="right">' . $alink . '</TD>' ;
echo '<TD>' . $row['create_date'] . '</TD>' ;
echo '<TD>' . $row['status'] . '</TD>' ;
echo '</TR>' ;
}
# End the table
echo '</TABLE>';
# Free up the results in memory
mysqli_free_result( $results ) ;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get_vehicles_by_price() {\n global $db;\n $query = 'SELECT * FROM vehicles\n ORDER BY price DESC';\n $statement = $db->prepare($query);\n $statement->execute();\n $vehicles = $statement->fetchAll();\n $statement->closeCursor();\n return $ve... | [
"0.721035",
"0.6168503",
"0.60461926",
"0.6002468",
"0.597751",
"0.5963464",
"0.58996195",
"0.5794403",
"0.5789841",
"0.5742664",
"0.57313246",
"0.5725735",
"0.5678571",
"0.5619953",
"0.5503527",
"0.5499075",
"0.54782397",
"0.5464432",
"0.5419354",
"0.5419088",
"0.54100794",
... | 0.0 | -1 |
Create query to get all details on an item | function show_record($dbc, $id){
$query = 'SELECT * FROM stuff WHERE id = ' . $id . '';
# Execute the query
$results = mysqli_query( $dbc, $query ) ;
check_results($results) ;
$row = mysqli_fetch_array( $results, MYSQLI_ASSOC) ;
# Show results
if ( $results ) {
# Initilizes the table before executing query.
echo '<DIV>' ;
echo '<TABLE border = "1" align= "center" cellpadding="5px" cellspacing=5px border = "1" >';
echo '<TR class="id">';
echo '<TD>ID:</TD>';
echo '<TD>'.$row['id'].'</TD>';
echo '<TR></TR>';
echo '<TR>';
echo '<TD>Item Name:</TD>';
echo '<TD>'.$row['item_name'].'</TD>';
echo '</TR>';
echo '<TR>';
echo '<TD>Location:</TD>' ;
echo '<TD>'.$row['location_id'].'</TD>';
echo '</TR>';
echo '<TR>';
echo '<TD>Description</TD>';
echo '<TD>'.$row['description'].'</TD>';
echo '</TR>';
echo '<TR>';
echo '<TD>Created</TD>';
echo '<TD>'.$row['create_date'].'</TD>';
echo '</TR>' ;
echo '<TR>' ;
echo '<TD>Owner</TD>';
echo '<TD>'.$row['owner'].'</TD>';
echo '</TR>' ;
echo '<TR>' ;
echo '<TD>Finder</TD>';
echo '<TD>'.$row['finder'].'</TD>';
echo '</TR>' ;
echo '<TR>' ;
echo '<TD>Status</TD>';
echo '<TD>'.$row['status'].'</TD>';
echo '</TR>' ;
echo '</TABLE>';
echo '</DIV>';
# For each row result, generate a table row
while ( $row = mysqli_fetch_array( $results , MYSQLI_ASSOC ) ) {
echo '<TR class="id">' ;
echo '<TD>' . $row['id'] . '</TD>' ;
echo '<TD>' . $row['item_name'] . '</TD>' ;
echo '</TR>' ;
}
# End the table
echo '</TABLE>';
# Free up the results in memory
mysqli_free_result( $results ) ;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function ItemInfoQuery() {\n\treturn $this->GetConnection()->MakeTableWrapper('vcqtItemsInfo');\n }",
"public function itemQuery()\n {\n return $this->item($this->getInput('id'));\n }",
"protected function ItemInfoQuery() {\n\treturn $this->Engine()->Make('vcqtImagesInfo');\n }",
... | [
"0.7338643",
"0.69641715",
"0.6879929",
"0.66940415",
"0.64425546",
"0.636812",
"0.63556993",
"0.62433225",
"0.62293965",
"0.61693454",
"0.6168883",
"0.61534375",
"0.61428285",
"0.61306006",
"0.6113986",
"0.6101691",
"0.60924286",
"0.60905284",
"0.6058249",
"0.6055408",
"0.60... | 0.0 | -1 |
Shows the query as a debugging aid | function show_query($query) {
global $debug;
if($debug)
echo "<p>Query = $query</p>" ;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function printquery(){\n\t\techo $this->query.\";\";\n\t}",
"public final function getQueryDebug()\n {\n $sql = $this->buildSqlString();\n\n $out = '\n\t\t<div class=\"debug\">\n\t\t\t<h3>SQL</h3>\n\t\t\t<p>' . $sql . '</p>\n\t\t\t<h3>Params</h3>\n\t\t\t' . $this->debug($this->param) . '\... | [
"0.7704094",
"0.74717724",
"0.73182344",
"0.72348976",
"0.72348976",
"0.7183185",
"0.71733016",
"0.71637195",
"0.7068388",
"0.69680417",
"0.68164",
"0.6735474",
"0.67048234",
"0.6661419",
"0.66545194",
"0.66503924",
"0.6643856",
"0.66430044",
"0.66264325",
"0.66179943",
"0.65... | 0.71795 | 6 |
Checks the inputed number for validity. | function valid_item_name ($item_name) {
if ( empty($item_name) )
return false;
else
return true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function input_number_is_valid( $number ) {\n\t\treturn ( is_numeric( $number ) && $number > 0 );\n\t}",
"public function isValid($number);",
"public function validate(string $number): bool;",
"abstract public function validateNumber(): bool;",
"public static function validInput($number)\r\n {\r\n ... | [
"0.81321514",
"0.80611885",
"0.7835089",
"0.78211963",
"0.7366171",
"0.72805893",
"0.7280396",
"0.72462964",
"0.7138083",
"0.7064233",
"0.7052229",
"0.7015122",
"0.69587135",
"0.69329333",
"0.69118494",
"0.6874888",
"0.68413836",
"0.6803531",
"0.67983115",
"0.6707958",
"0.666... | 0.0 | -1 |
Checks the query results as a debugging aid | function check_results($results) {
global $dbc;
if($results != true)
echo '<p>SQL ERROR = ' . mysqli_error( $dbc ) . '</p>' ;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function printSqlCheck() {}",
"function debugging() {\n\t\t$result = $this->connection->prepare(\"SELECT * FROM admins\");\n\t\t$result->execute();\n\t\treturn $result->fetchAll();\n\t}",
"function queryDebug($resultVar){\n\tif (!$resultVar) {\n\t\t$message = 'Invalid query: ' . mysql_error() . \"\\... | [
"0.6636826",
"0.64521456",
"0.6436782",
"0.62944865",
"0.6272143",
"0.62406516",
"0.6168132",
"0.6140891",
"0.6134641",
"0.6033268",
"0.60119975",
"0.60107106",
"0.5960356",
"0.5945545",
"0.589718",
"0.58958215",
"0.58827114",
"0.5872968",
"0.58247524",
"0.5796907",
"0.579555... | 0.59669286 | 13 |
Count elements of an object | public function count()
{
return ++$this->id;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public abstract function countObjects();",
"public function count() {\r\n return count($this->objects);\r\n }",
"public function count(): int {\n return count($this->toArray());\n }",
"public function count()\n {\n // NOTE: Cannot use \\COUNT_RECURSIVE because that counts the arrays\n... | [
"0.7844575",
"0.7308457",
"0.7274846",
"0.72054976",
"0.71488273",
"0.70194924",
"0.6937613",
"0.6936243",
"0.6926989",
"0.6924251",
"0.6924251",
"0.6924251",
"0.6924251",
"0.69202334",
"0.6894718",
"0.68790454",
"0.68629766",
"0.683714",
"0.6827706",
"0.6827706",
"0.6827706"... | 0.0 | -1 |
Get time diff in humanreadable format. | public static function timeDiff($periodStartDate, $periodEndDate)
{
/**
* @var \DateTime $fromDate
* @var \DateTime $toDate
*/
// @codeCoverageIgnoreStart
$dateRange = new DateRange($periodStartDate, $periodEndDate);
$fromDate = $dateRange->getRangeBegin();
$toDate = $dateRange->getRangeEnd();
// @codeCoverageIgnoreEnd
$diff = $fromDate->diff($toDate);
// @codeCoverageIgnoreStart
if ($diff === false) {
throw new \RuntimeException('Unexpected runtime error.');
}
// @codeCoverageIgnoreEnd
if ($diff->invert === 1) {
throw new \InvalidArgumentException(
'$periodStartDate argument can not be greater than $periodEndDate argument.'
);
}
$translations = static::loadTranslations(__FUNCTION__);
if ($diff->y >= 1) {
$text = UString::plural($diff->y, $translations['year'], true);
} elseif ($diff->m >= 1) {
$text = UString::plural($diff->m, $translations['month'], true);
} elseif ($diff->d >= 7) {
$text = UString::plural(ceil($diff->d / 7), $translations['week'], true);
} elseif ($diff->d >= 1) {
$text = UString::plural($diff->d, $translations['day'], true);
} elseif ($diff->h >= 1) {
$text = UString::plural($diff->h, $translations['hour'], true);
} elseif ($diff->i >= 1) {
$text = UString::plural($diff->i, $translations['minute'], true);
} elseif ($diff->s >= 1) {
$text = UString::plural($diff->s, $translations['second'], true);
} else {
$text = UString::plural(0, $translations['second'], true);
}
return trim($text) . ' ' . $translations['ago'];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function formatDiffTime($t) {\n\n\t\t/*\n\t\tif ($t) {\n\t\t\t$t = $t/10; // convert from 10ths of seconds into seconds\n\t\t\tif ($t > 3600) \t\t\n\t\t\t\treturn sprintf(\"+%d:%02d:%02d\", $t/3600, ($t/60)%60, $t%60);\n\t\t\telse\n\t\t\t\treturn sprintf(\"+%d:%02d\", ($t/60)%60, $t%60);\n\t\t}\n\t\t*/\n\n\t\t// T... | [
"0.67907834",
"0.6756366",
"0.65380967",
"0.65217346",
"0.6517339",
"0.64892644",
"0.647118",
"0.6467001",
"0.64599043",
"0.64472467",
"0.64437413",
"0.6417667",
"0.64136606",
"0.63823646",
"0.6346818",
"0.63065225",
"0.62692624",
"0.6263801",
"0.6223458",
"0.6186265",
"0.617... | 0.0 | -1 |
Return seconds difference between two dates. | public static function secondsDiff($periodStartDate, $periodEndDate)
{
/**
* @var \DateTime $fromDate
* @var \DateTime $toDate
*/
// @codeCoverageIgnoreStart
$dateRange = new DateRange($periodStartDate, $periodEndDate);
$fromDate = $dateRange->getRangeBegin();
$toDate = $dateRange->getRangeEnd();
// @codeCoverageIgnoreEnd
$diff = $fromDate->diff($toDate);
// @codeCoverageIgnoreStart
if ($diff === false) {
throw new \RuntimeException('Unexpected runtime error.');
}
// @codeCoverageIgnoreEnd
if ($diff->y > 0 || $diff->m > 0) {
throw new \OutOfRangeException('Date diff may not exceed one month.');
}
$seconds = 0;
if ($diff->d >= 1) {
$seconds += $diff->d * 24 * 60 * 60;
}
if ($diff->h >= 1) {
$seconds += $diff->h * 60 * 60;
}
if ($diff->i >= 1) {
$seconds += $diff->i * 60;
}
if ($diff->s >= 1) {
$seconds += $diff->s;
}
return $diff->invert === 0 ? $seconds : -$seconds;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function diffInSeconds ($firstDate, $secondDate)\n\t{\n\t\t$diff = $firstDate - $secondDate;\n\t\treturn $diff;\n\t}",
"public static function diff(Date $a, Date $b) {\n return new TimeSpan($a->getTime() - $b->getTime());\n }",
"function dateDiff($date1, $date2){\n\t $date1_ts = strtotime($date1);\n\t $... | [
"0.7046257",
"0.6965999",
"0.679718",
"0.6781185",
"0.6700592",
"0.663406",
"0.66150284",
"0.649206",
"0.6422793",
"0.6418234",
"0.64164495",
"0.6407968",
"0.63969415",
"0.6373387",
"0.633611",
"0.63041705",
"0.6250982",
"0.620842",
"0.6173213",
"0.6166254",
"0.6165687",
"0... | 0.622516 | 17 |
Assign custom renderer for product create/edit form weee attribute element | public function execute(\Magento\Framework\Event\Observer $observer)
{
/** @var \Magento\Framework\Data\Form $form */
$form = $observer->getEvent()->getForm();
$attributes = $this->weeeTax->getWeeeAttributeCodes(true);
foreach ($attributes as $code) {
$weeeTax = $form->getElement($code);
if ($weeeTax) {
$weeeTax->setRenderer($this->layout->createBlock(\Magento\Weee\Block\Renderer\Weee\Tax::class));
}
}
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function processAction() {\n\t\t$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper ( 'redirector' );\n\t\t$form = $this->getForm ( \"/admin/productsattributes/process\" );\n\t\t$request = $this->getRequest ();\n\t\t\n\t\t// Create the buttons in the edit form\r\n\t\t$this->view->buttons = ar... | [
"0.6033033",
"0.59332925",
"0.5881972",
"0.58099",
"0.5770208",
"0.57463235",
"0.5741194",
"0.5665767",
"0.56270146",
"0.5617247",
"0.5613511",
"0.5611123",
"0.56069696",
"0.56007683",
"0.5566038",
"0.5563113",
"0.554752",
"0.554752",
"0.5543203",
"0.55421084",
"0.5537036",
... | 0.0 | -1 |
Determine if the user is authorized to make this request. | public function authorize()
{
/*
| -----------------------------------------------------------------------
| *return false devuelve un error HTTP Response 403 Forbidden (prohibido)
| *return true Verifica si la validación es correcta
| -----------------------------------------------------------------------
*/
return true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function authorize()\n {\n if ($this->user() !== null) {\n return true;\n }\n return false;\n }",
"public function authorize()\n {\n return $this->user() !== null;\n }",
"public function authorize()\n {\n return $this->user() !== null;\n }"... | [
"0.8400091",
"0.8376151",
"0.8376151",
"0.8343046",
"0.8252765",
"0.82470274",
"0.82118946",
"0.8145545",
"0.8110389",
"0.8082113",
"0.7991577",
"0.7989312",
"0.7982695",
"0.79595965",
"0.79507434",
"0.794834",
"0.7925477",
"0.7914969",
"0.7899856",
"0.7893212",
"0.78900343",... | 0.0 | -1 |
Get the validation rules that apply to the request. | public function rules()
{
/*
| -------------------------------------
| *Reglas de validación
| *'required' el campo es obligatorio
| -------------------------------------
*/
return [
'title' => 'required',
'url' => 'required',
'description' => 'required',
];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function rules()\n {\n $commons = [\n\n ];\n return get_request_rules($this, $commons);\n }",
"public function getRules()\n {\n return $this->validator->getRules();\n }",
"public function getValidationRules()\n {\n $rules = [];\n\n // Get the sche... | [
"0.8342797",
"0.8013068",
"0.79357624",
"0.79257727",
"0.7922943",
"0.7903906",
"0.7859204",
"0.7789624",
"0.7783409",
"0.77624106",
"0.773673",
"0.7732383",
"0.77094924",
"0.7691624",
"0.7684878",
"0.7682184",
"0.7682184",
"0.7682184",
"0.7682184",
"0.7682184",
"0.7682184",
... | 0.0 | -1 |
Create a new Halcyon model instance. | public function __construct(array $attributes = [])
{
$this->bootIfNotBooted();
$this->bootNicerEvents();
parent::__construct();
$this->syncOriginal();
$this->fill($attributes);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function createModel()\n {\n return new LeafModel();\n }",
"protected function createModel()\n {\n $model = $this->info['model'];\n\n $modelName = basename(str_replace('\\\\', '/', $model));\n\n // make it singular\n $modelName = Str::singular($modelName);\n\... | [
"0.60297686",
"0.59523946",
"0.59241045",
"0.58935",
"0.58167464",
"0.57155144",
"0.57107437",
"0.5598737",
"0.5597764",
"0.55262494",
"0.5496319",
"0.548385",
"0.5480709",
"0.54763633",
"0.5468845",
"0.53488064",
"0.53470814",
"0.5345576",
"0.52829903",
"0.5282083",
"0.52762... | 0.0 | -1 |
Check if the model needs to be booted and if so, do it. | protected function bootIfNotBooted()
{
$class = get_class($this);
if (!isset(static::$booted[$class])) {
static::$booted[$class] = true;
$this->fireModelEvent('booting', false);
static::boot();
$this->fireModelEvent('booted', false);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function bootIfNotBooted()\n {\n if (! isset(static::$booted[static::class])) {\n static::$booted[static::class] = true;\n\n $this->fireModelEvent('booting', false);\n\n static::booting();\n static::boot();\n static::booted();\n\n ... | [
"0.7757148",
"0.7738016",
"0.68692267",
"0.6569194",
"0.6398186",
"0.6320947",
"0.62552536",
"0.62552536",
"0.6254373",
"0.6200845",
"0.6198142",
"0.617447",
"0.6161423",
"0.61529565",
"0.60718995",
"0.605006",
"0.6036296",
"0.6030147",
"0.60175306",
"0.60129666",
"0.60129666... | 0.74536496 | 2 |
The "booting" method of the model. | protected static function boot()
{
static::bootTraits();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected static function booting()\n {\n //\n }",
"protected static function booted()\n {\n //\n }",
"protected static function booted()\n {\n //\n }",
"public function boot()\r\n {\r\n parent::boot();\r\n\r\n //\r\n }",
"public function boot()\r\... | [
"0.7670344",
"0.7390779",
"0.7390779",
"0.7292516",
"0.7292516",
"0.7270451",
"0.72549695",
"0.72524065",
"0.72169435",
"0.72169435",
"0.72169435",
"0.72169435",
"0.72169435",
"0.72169435",
"0.72169435",
"0.72169435",
"0.72169435",
"0.72143155",
"0.72143155",
"0.7200063",
"0.... | 0.0 | -1 |
Boot all of the bootable traits on the model. | protected static function bootTraits()
{
foreach (class_uses_recursive(get_called_class()) as $trait) {
if (method_exists(get_called_class(), $method = 'boot'.class_basename($trait))) {
forward_static_call([get_called_class(), $method]);
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected static function boot()\n {\n static::bootTraits();\n }",
"protected static function boot()\n {\n static::bootTraits();\n }",
"protected static function boot()\n {\n static::bootTraits();\n }",
"public static function bootTraits( ) : void {\n $class = st... | [
"0.79026926",
"0.79026926",
"0.79026926",
"0.7606671",
"0.7461718",
"0.7451545",
"0.7417128",
"0.74089307",
"0.6662075",
"0.6616231",
"0.66031927",
"0.65557903",
"0.6404938",
"0.6398934",
"0.63755596",
"0.6372214",
"0.6357444",
"0.63439137",
"0.63296634",
"0.63077223",
"0.630... | 0.74236524 | 6 |
Clear the list of booted models so they will be rebooted. | public static function clearBootedModels()
{
static::$booted = [];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public static function clearBootedModels();",
"public function clearModels();",
"protected static function booted(): void\n {\n static::deleting(function (Model $model) {\n $model->removeAllImages();\n });\n }",
"protected function forgetAddedModels()\n {\n $this->qua... | [
"0.8700318",
"0.72563404",
"0.66823345",
"0.66046894",
"0.6544441",
"0.63992864",
"0.63572377",
"0.6318385",
"0.6299947",
"0.62808114",
"0.6279543",
"0.6196935",
"0.616978",
"0.6148886",
"0.6119523",
"0.61061716",
"0.6072173",
"0.6064169",
"0.6059776",
"0.6058886",
"0.6057026... | 0.89517516 | 1 |
Bind some nicer events to this model, in the format of method overrides. | protected function bootNicerEvents()
{
$class = get_called_class();
if (isset(static::$eventsBooted[$class])) {
return;
}
$radicals = ['creat', 'sav', 'updat', 'delet', 'fetch'];
$hooks = ['before' => 'ing', 'after' => 'ed'];
foreach ($radicals as $radical) {
foreach ($hooks as $hook => $event) {
$eventMethod = $radical . $event; // saving / saved
$method = $hook . ucfirst($radical); // beforeSave / afterSave
if ($radical != 'fetch') $method .= 'e';
self::$eventMethod(function($model) use ($method) {
$model->fireEvent('model.' . $method);
if ($model->methodExists($method))
return $model->$method();
});
}
}
/*
* Hook to boot events
*/
static::registerModelEvent('booted', function($model){
$model->fireEvent('model.afterBoot');
if ($model->methodExists('afterBoot'))
return $model->afterBoot();
});
static::$eventsBooted[$class] = true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getModelEvents();",
"protected static function boot()\r\n {\r\n parent::boot();\r\n\r\n foreach (static::$handleableEvents as $event) {\r\n static::$event(function($model) use ($event) {\r\n /** @var Model $model */\r\n return $model->hand... | [
"0.6627599",
"0.60743034",
"0.5910263",
"0.59091705",
"0.5827657",
"0.5777322",
"0.57460344",
"0.57268727",
"0.57248527",
"0.57248527",
"0.5663562",
"0.5639806",
"0.55048853",
"0.54647875",
"0.5440618",
"0.5407723",
"0.54037166",
"0.5395376",
"0.536985",
"0.53661704",
"0.5299... | 0.59901035 | 2 |
Returns the file name without the extension. | public function getBaseFileNameAttribute()
{
$pos = strrpos($this->fileName, '.');
if ($pos === false) {
return $this->fileName;
}
return substr($this->fileName, 0, $pos);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getFileName()\n {\n return basename($this->file, '.' . $this->getExtension());\n }",
"public function fileName()\n {\n return $this->getCleanString(self::$_file_name_clean);\n }",
"function file_ext_strip($filename){\n\t return preg_replace('/.[^.]*$/', '', $filenam... | [
"0.81711096",
"0.7957715",
"0.7883327",
"0.78741014",
"0.7840685",
"0.78385985",
"0.78074",
"0.77643967",
"0.7749171",
"0.7729871",
"0.7691143",
"0.7681457",
"0.7643441",
"0.76256984",
"0.7596352",
"0.7593597",
"0.75891966",
"0.75736976",
"0.75505614",
"0.7548727",
"0.7546869... | 0.7193177 | 49 |
Adds an attribute to the purgeable attributes list | public function addPurgeable($attributes = null)
{
$attributes = is_array($attributes) ? $attributes : func_get_args();
$this->purgeable = array_merge($this->purgeable, $attributes);
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function AddAttribute() {\n $db = Core::GetDB();\n\n $id = Core::GetFromPOST('id');\n $attrs = Core::GetFromPOST('attrs');\n\n $attrs = fix_attrs($attrs);\n\n foreach ($attrs AS $attr) {\n $attr = explode(':', $attr);\n\n if (count($attr) == 3) {\n if (empty($attr) === false... | [
"0.6281261",
"0.61672014",
"0.60503364",
"0.5977922",
"0.5954943",
"0.590952",
"0.58700424",
"0.58115685",
"0.5754149",
"0.56519103",
"0.5650959",
"0.56203955",
"0.5573173",
"0.557189",
"0.551486",
"0.5494973",
"0.5462906",
"0.54597425",
"0.53793925",
"0.53790087",
"0.5371088... | 0.6148048 | 2 |
The settings is attribute contains everything that should be saved to the settings area. | public function getSettingsAttribute()
{
$defaults = [
'fileName',
'components',
'content',
'markup',
'mtime',
'code'
];
$dynPropNames = array_keys(array_diff_key($this->getDynamicProperties(), ['purgeable' => 0]));
return array_diff_key(
$this->attributes,
array_flip(array_merge($defaults, $this->purgeable, $dynPropNames))
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function save_settings($settings)\n {\n }",
"public function saveSettings()\n {\n if (empty($this->settings)) {\n $this->loadSettings();\n }\n \n $this->saveJSON($this->settings);\n }",
"public function getSettings()\n\t{\n\t\treturn $this->sett... | [
"0.7427756",
"0.739885",
"0.7351334",
"0.73493344",
"0.7334695",
"0.732518",
"0.728044",
"0.72446024",
"0.72446024",
"0.72446024",
"0.72446024",
"0.72123367",
"0.7179148",
"0.7152195",
"0.710572",
"0.7090442",
"0.70717824",
"0.7045257",
"0.7038667",
"0.70242596",
"0.70217115"... | 0.0 | -1 |
Filling the settings should merge it with attributes. | public function setSettingsAttribute($value)
{
if (is_array($value)) {
$this->attributes = array_merge($this->attributes, $value);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function init_settings()\n {\n /** @noinspection PhpUndefinedClassInspection */\n parent::init_settings();\n\n $sharedOptions = get_option(SharedPersistor::OPTION_NAME, []) ?: [];\n $this->settings = array_merge($this->settings, $sharedOptions);\n }",
"public function ini... | [
"0.64047515",
"0.6357996",
"0.6268254",
"0.6249794",
"0.62192845",
"0.6207818",
"0.61911374",
"0.61730784",
"0.6172418",
"0.6172418",
"0.616733",
"0.61395514",
"0.6135785",
"0.6133022",
"0.61217064",
"0.61113703",
"0.6096595",
"0.60568434",
"0.6048388",
"0.6032008",
"0.602175... | 0.0 | -1 |
File name should always contain an extension. | public function setFileNameAttribute($value)
{
$fileName = trim($value);
if (strlen($fileName) && !strlen(pathinfo($value, PATHINFO_EXTENSION))) {
$fileName .= '.'.$this->defaultExtension;
}
$this->attributes['fileName'] = $fileName;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function file_ext($filename) {\n\t if( !preg_match('/./', $filename) ) return '';\n\t return preg_replace('/^.*./', '', $filename);\n\t}",
"public function getFileExtension();",
"function file_extension($filename)\n\t\t{\n\t\t\t$fileparts = explode(\".\", $filename);\n\t\t\t$more_check = strpos(strtolowe... | [
"0.7909113",
"0.7488397",
"0.7477418",
"0.745618",
"0.7391999",
"0.7383204",
"0.73103184",
"0.7308733",
"0.725133",
"0.72286564",
"0.7212832",
"0.7186276",
"0.7185842",
"0.7173767",
"0.71632063",
"0.7146784",
"0.713156",
"0.70996696",
"0.7089567",
"0.708731",
"0.70719486",
... | 0.0 | -1 |
Returns the directory name corresponding to the object type. For pages the directory name is "pages", for layouts "layouts", etc. | public function getObjectTypeDirName()
{
return $this->dirName;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"private function dirName()\n {\n return str_plural(strtolower($this->itemClass()));\n }",
"private function _getTypeDirectory( $type )\n\t\t{\n\t\t\t$config = Config::getInstance();\n\t\t\t$directory = null;\n\t\t\tswitch ( $type ) {\n\t\t\t\tcase 'installed':\n\t\t\t\tcase 'uninstalled':\n\t\t\t\t\... | [
"0.69865394",
"0.67635524",
"0.6652575",
"0.6649803",
"0.66300887",
"0.6527499",
"0.6215122",
"0.61566806",
"0.61389947",
"0.6063629",
"0.6054397",
"0.6043413",
"0.60420436",
"0.6017169",
"0.60124964",
"0.6008611",
"0.59829533",
"0.59541494",
"0.59476876",
"0.593549",
"0.5918... | 0.8279505 | 0 |
Returns the allowable file extensions supported by this model. | public function getAllowedExtensions()
{
return $this->allowedExtensions;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getAllowedExtensions()\n {\n return $this->allowedFiles;\n }",
"public function getAllowFileExtensions()\n\t{\n\t\treturn implode(',', array_merge($this->videoExtensions, $this->imageExtensions, $this->audioExtensions, $this->docExtensions ));\n\t\t//return Yii::app()->params['fileEx... | [
"0.8461188",
"0.8457372",
"0.8232295",
"0.8076225",
"0.80326235",
"0.8010132",
"0.79803705",
"0.7969229",
"0.7890523",
"0.7772665",
"0.77056307",
"0.7682949",
"0.76175076",
"0.7610192",
"0.7596606",
"0.7584177",
"0.7546928",
"0.73727226",
"0.7274616",
"0.71379167",
"0.7080669... | 0.8153383 | 4 |
Returns true if this template supports code and settings sections. | public function isCompoundObject()
{
return $this->isCompoundObject;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function uses_sections() {\n return true;\n }",
"public function uses_sections() {\n return true;\n }",
"public function uses_sections() {\n\n return true;\n\n }",
"function audioman_is_featured_content_active( $control ) {\n\t\t$enable = $control->manager->get_setting( '... | [
"0.62456125",
"0.62456125",
"0.6217306",
"0.6164516",
"0.61567104",
"0.6141743",
"0.60814077",
"0.5994584",
"0.5994584",
"0.5968082",
"0.59273773",
"0.5896709",
"0.5836879",
"0.5798668",
"0.57735574",
"0.57735574",
"0.5771515",
"0.5762758",
"0.5761735",
"0.575217",
"0.5739659... | 0.0 | -1 |
Returns true if the code section will be wrapped in PHP tags. | public function getWrapCode()
{
return $this->wrapCode;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function isHtmlBlock()\n {\n return (! $this->isPhpBlock());\n }",
"function compile($name, $code = false)\n {\n\t\tif (!$code)\n\t\t{\n\t\t\t$code = file_get_contents($this->template_dir.$name);\n\t\n\t\t\tif ($code === false)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tpreg_ma... | [
"0.6342579",
"0.6015344",
"0.5999089",
"0.5777366",
"0.5766227",
"0.571766",
"0.5703856",
"0.5689268",
"0.5634954",
"0.5601844",
"0.5583934",
"0.5579047",
"0.55535275",
"0.553919",
"0.5524793",
"0.5501309",
"0.54886746",
"0.5473864",
"0.5430884",
"0.53993154",
"0.5393771",
... | 0.0 | -1 |
Returns the maximum directory nesting allowed by this template. | public function getMaxNesting()
{
return $this->maxNesting;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function maxDepth()\n {\n if ($this->maxDepth === null) {\n return static::DEFAULT_MAX_DEPTH;\n }\n\n return $this->maxDepth;\n }",
"public static function getMaximumPathLength() {}",
"public function getDepth(): int\n {\n return count(explode('/', $this->... | [
"0.6367185",
"0.6237618",
"0.6235076",
"0.6183445",
"0.6144252",
"0.612431",
"0.60825133",
"0.59626013",
"0.59626013",
"0.5907675",
"0.5822726",
"0.5790901",
"0.57689506",
"0.57647324",
"0.5746729",
"0.572063",
"0.56975687",
"0.56738526",
"0.56526834",
"0.5572018",
"0.5532492... | 0.7226511 | 0 |
Returns true if the object was loaded from the cache. | public function isLoadedFromCache()
{
return $this->loadedFromCache;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function loadCacheData()\n\t{\n\t\t//is it enabled?\n\t\tif ($this->useObjectCaching)\n\t\t{\n\t\t\t//get our cache data... is it there?\n\t\t\t$data = $this->getCache();\n\t\t\tif ($data)\n\t\t\t{\n\t\t\t\t//load it, and we're good.\n\t\t\t\t$this->hydrate($data);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n... | [
"0.8096812",
"0.7640676",
"0.7482657",
"0.74748504",
"0.74692136",
"0.74615556",
"0.74591196",
"0.7450629",
"0.7428408",
"0.74026287",
"0.7331308",
"0.7271206",
"0.72503763",
"0.72425246",
"0.7219823",
"0.71931124",
"0.7180526",
"0.71777904",
"0.71598095",
"0.7149306",
"0.714... | 0.8554659 | 0 |
Returns true if the object was loaded from the cache. | public function setLoadedFromCache($value)
{
$this->loadedFromCache = (bool) $value;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function isLoadedFromCache()\n {\n return $this->loadedFromCache;\n }",
"protected function loadCacheData()\n\t{\n\t\t//is it enabled?\n\t\tif ($this->useObjectCaching)\n\t\t{\n\t\t\t//get our cache data... is it there?\n\t\t\t$data = $this->getCache();\n\t\t\tif ($data)\n\t\t\t{\n\t\t\t\t//l... | [
"0.8554635",
"0.8096812",
"0.76406664",
"0.7482658",
"0.7474846",
"0.7469178",
"0.7461557",
"0.7459111",
"0.74506027",
"0.74284035",
"0.74025965",
"0.7331312",
"0.7271191",
"0.7250365",
"0.7242507",
"0.72198266",
"0.71930975",
"0.71804994",
"0.7177764",
"0.71597815",
"0.71493... | 0.0 | -1 |
Fill the model with an array of attributes. | public function fill(array $attributes)
{
foreach ($this->fillableFromArray($attributes) as $key => $value) {
if ($this->isFillable($key)) {
$this->setAttribute($key, $value);
}
}
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function fill(array $attributes);",
"public function fill(array $attributes = []);",
"public function fill(Identifiable $model, array $attributes);",
"public function fill(array $attributes = [])\n {\n // start_measure('fill-model', 'Création de l\\'objet '.static::class);\n foreach (... | [
"0.7654308",
"0.75207293",
"0.7401452",
"0.71766514",
"0.70241576",
"0.70226705",
"0.7011032",
"0.6890579",
"0.6855368",
"0.6816414",
"0.6745761",
"0.66773254",
"0.6670295",
"0.6670295",
"0.6660146",
"0.66436523",
"0.66341853",
"0.65938205",
"0.65899813",
"0.65620536",
"0.643... | 0.6774815 | 10 |
Get the fillable attributes of a given array. | protected function fillableFromArray(array $attributes)
{
$defaults = ['fileName'];
if (count($this->fillable) > 0) {
return array_intersect_key(
$attributes,
array_flip(array_merge($defaults, $this->fillable))
);
}
return $attributes;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function fillableFromArray(array $attributes)\n {\n if (count($this->fillable) > 0 && !static::$unguarded)\n return array_intersect_key($attributes, array_flip($this->fillable));\n\n return $attributes;\n }",
"protected function fillableFromArray(array $attributes)\n {... | [
"0.7485169",
"0.7431268",
"0.65387875",
"0.6369011",
"0.6369011",
"0.61958706",
"0.61957335",
"0.61303127",
"0.61303127",
"0.61303127",
"0.61303127",
"0.61298674",
"0.6035263",
"0.60131687",
"0.59887",
"0.5970922",
"0.5961864",
"0.59574443",
"0.59520197",
"0.59307975",
"0.592... | 0.7535031 | 0 |
Create a new instance of the given model. | public function newInstance($attributes = [], $exists = false)
{
// This method just provides a convenient way for us to generate fresh model
// instances of this current model. It is particularly useful during the
// hydration of new objects via the Halcyon query builder instances.
$model = new static((array) $attributes);
$model->exists = $exists;
return $model;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function create(Model $model);",
"public static function newModel()\n {\n $model = static::$model;\n\n return new $model;\n }",
"public static function from(Model $model)\n {\n return new static($model);\n }",
"public function createModel()\n {\n $class = '\\... | [
"0.82489604",
"0.7996992",
"0.76176596",
"0.7520926",
"0.7520926",
"0.75158346",
"0.75001466",
"0.74945736",
"0.7492397",
"0.7473658",
"0.74309605",
"0.73189354",
"0.7238691",
"0.7224371",
"0.72191375",
"0.72133934",
"0.72106177",
"0.7170888",
"0.716543",
"0.71643466",
"0.713... | 0.0 | -1 |
Create a new model instance that is existing. | public function newFromBuilder($attributes = [], $datasource = null)
{
$instance = $this->newInstance([], true);
if ($instance->fireModelEvent('fetching') === false) {
return $instance;
}
$instance->setRawAttributes((array) $attributes, true);
$instance->fireModelEvent('fetched', false);
$instance->setDatasource($datasource ?: $this->datasource);
return $instance;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function create()\n {\n return $this->modelManager->instance($this->model);\n }",
"public function create(): Model;",
"public function create(Model $model);",
"public static function newModel()\n {\n $model = static::$model;\n\n return new $model;\n }",
"protected fu... | [
"0.73426616",
"0.7313782",
"0.7259265",
"0.7162958",
"0.7137214",
"0.70039785",
"0.6997961",
"0.69303906",
"0.6899517",
"0.68280137",
"0.67946273",
"0.67726487",
"0.6711098",
"0.6698336",
"0.66924787",
"0.66451305",
"0.66451156",
"0.6612408",
"0.6593344",
"0.65752167",
"0.656... | 0.0 | -1 |
Create a collection of models from plain arrays. | public static function hydrate(array $items, $datasource = null)
{
$instance = (new static)->setDatasource($datasource);
$items = array_map(function ($item) use ($instance) {
return $instance->newFromBuilder($item);
}, $items);
return $instance->newCollection($items);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function newCollection(array $models = []);",
"public function create(): array\n {\n return array_map(fn() => self::newModel($this->model, $this->definition()), range(1, $this->count));\n }",
"public static function createManyFromArray(array $posts): Collection\n {\n return collec... | [
"0.6637981",
"0.62146586",
"0.61324024",
"0.6120789",
"0.6120789",
"0.6099168",
"0.60229367",
"0.5988837",
"0.5981549",
"0.59146214",
"0.59094524",
"0.59094524",
"0.59094524",
"0.59057826",
"0.5883332",
"0.5875364",
"0.58474034",
"0.5805666",
"0.57589793",
"0.5745693",
"0.572... | 0.57339096 | 20 |
Save a new model and return the instance. | public static function create(array $attributes = [])
{
$model = new static($attributes);
$model->save();
return $model;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function save() {\r\n if ($this->model->getId()) {\r\n return $this->model->update();\r\n }\r\n return $this->create();\r\n }",
"public function store()\n {\n Log::debug(\"STORE MODEL: $this->request\");\n return $this->saveModel();\n }",
"public fu... | [
"0.79149723",
"0.7302606",
"0.6976441",
"0.69518477",
"0.68823975",
"0.68041086",
"0.67284393",
"0.66490966",
"0.6643495",
"0.661478",
"0.66018224",
"0.6598074",
"0.6595255",
"0.6593825",
"0.6568989",
"0.65638083",
"0.6550679",
"0.6550679",
"0.6549599",
"0.6533402",
"0.652936... | 0.0 | -1 |
Begin querying the model. | public static function query()
{
return (new static)->newQuery();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function query()\n {\n }",
"public function query()\n {\n }",
"public static function query()\n {\n }",
"public function Query() {\n \n }",
"function begin() {\n\t\t\tself::$db->begin();\n\t\t\t$this->begin_executed = true;\n\t\t}",
"public funct... | [
"0.6952657",
"0.6952657",
"0.66653293",
"0.6415399",
"0.6407923",
"0.64002293",
"0.63524437",
"0.6252773",
"0.6252773",
"0.6252773",
"0.61948395",
"0.61473244",
"0.6098904",
"0.6090589",
"0.60617495",
"0.60617495",
"0.60617495",
"0.6025989",
"0.60223746",
"0.5996114",
"0.5929... | 0.0 | -1 |
Begin querying the model on a given datasource. | public static function on($datasource = null)
{
// First we will just create a fresh instance of this model, and then we can
// set the datasource on the model so that it is be used for the queries.
$instance = new static;
$instance->setDatasource($datasource);
return $instance;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function _begin() {\n $this->dataSource = $this->getDataSource();\n }",
"public function query()\n {\n }",
"public function query()\n {\n }",
"public static function query()\n {\n }",
"protected function _prepareDataSource()\n {\n $stu... | [
"0.62705046",
"0.57180166",
"0.57180166",
"0.55329007",
"0.54861385",
"0.5434531",
"0.5391682",
"0.5382354",
"0.5382226",
"0.5377971",
"0.5340848",
"0.5328232",
"0.53251165",
"0.5315929",
"0.53053886",
"0.53053886",
"0.53053886",
"0.5304093",
"0.5261137",
"0.5259548",
"0.5252... | 0.0 | -1 |
Get all of the models from the datasource. | public static function all()
{
$instance = new static;
return $instance->newQuery()->get();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getModels();",
"public function getModels();",
"public function all()\n {\n return $this->model->get();\n }",
"private function getAllModels()\n {\n return (object)ModelRegistry::getAllObjects();\n }",
"public function fetch_all_models() {\n global $pdo;\n\n ... | [
"0.7429063",
"0.7429063",
"0.73888606",
"0.73372847",
"0.728668",
"0.72763205",
"0.72763205",
"0.7238573",
"0.71929073",
"0.71878695",
"0.7182593",
"0.7147522",
"0.7147522",
"0.7147522",
"0.7116513",
"0.70011634",
"0.6961512",
"0.6951955",
"0.68648547",
"0.68562293",
"0.68237... | 0.0 | -1 |
Determine if the given attribute may be mass assigned. | public function isFillable($key)
{
// File name is always treated as a fillable attribute.
if ($key === 'fileName') {
return true;
}
// If the key is in the "fillable" array, we can of course assume that it's
// a fillable attribute. Otherwise, we will check the guarded array when
// we need to determine if the attribute is black-listed on the model.
if (in_array($key, $this->fillable)) {
return true;
}
return empty($this->fillable) && !Str::startsWith($key, '_');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public static function checkMassAssignment(array $attributes);",
"public function totallyGuarded()\n {\n return count($this->fillable) == 0 && $this->guarded == ['*'];\n }",
"public function totallyGuarded()\n {\n return count($this->fillable) == 0 && $this->guarded == ['*'];\n }",
... | [
"0.6812852",
"0.62336075",
"0.62336075",
"0.61449885",
"0.6084034",
"0.59754044",
"0.5960416",
"0.5914456",
"0.58636475",
"0.58603245",
"0.5849821",
"0.58410704",
"0.58376294",
"0.58182704",
"0.5798177",
"0.57913953",
"0.5790532",
"0.57881373",
"0.57667387",
"0.57655424",
"0.... | 0.5559737 | 35 |
Convert the model instance to JSON. | public function toJson($options = 0)
{
return json_encode($this->jsonSerialize(), $options);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function toJson() {\n\t\t\treturn json_encode(array(\n\t\t\t\t'id' => $this->id,\n\t\t\t\t'model' => $this->model,\n\t\t\t\t'type' => json_decode($this->type->toJson()),\n\t\t\t\t'description' => $this->description,\n\t\t\t\t'area' => json_decode($this->area->toJson()),\n\t\t\t\t'status' => $this->status\n\... | [
"0.77430385",
"0.75988156",
"0.7591963",
"0.74660426",
"0.73752135",
"0.73752135",
"0.73489326",
"0.7348418",
"0.7344734",
"0.73240274",
"0.7286465",
"0.7279254",
"0.72728163",
"0.72728163",
"0.72728163",
"0.72728163",
"0.72728163",
"0.72728163",
"0.72728163",
"0.72728163",
"... | 0.0 | -1 |
Convert the object into something JSON serializable. | public function jsonSerialize()
{
return $this->toArray();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toJson($object);",
"function to_json(tSerializable $object){\r\n return json_encode($object->jsonData());\r\n}",
"public function _jsonSerialize();",
"final public function jsonSerialize() {}",
"public function json(){ return json_encode( $this->objectify() ); }",
"public function jsonSeriali... | [
"0.8040326",
"0.77460027",
"0.7661239",
"0.7634606",
"0.7590505",
"0.74368227",
"0.74368227",
"0.74368227",
"0.74368227",
"0.74368227",
"0.74368227",
"0.74368227",
"0.74368227",
"0.7416366",
"0.7416366",
"0.7401669",
"0.7401669",
"0.7401669",
"0.7401669",
"0.7401669",
"0.7401... | 0.0 | -1 |
Convert the model instance to an array. | public function toArray()
{
return $this->attributesToArray();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public abstract function toArray($model);",
"function asArray(){\n\t\t\t$array = $this->toArray( $this );\n\t\t\treturn $array;\n\t\t}",
"public function toArray()\n {\n return $this->cast('array');\n }",
"public function toArray() {\n return (array)$this;\n }",
"public function to_array()... | [
"0.77884513",
"0.772852",
"0.76385117",
"0.76180094",
"0.76172066",
"0.76172066",
"0.76172066",
"0.761628",
"0.761628",
"0.7615716",
"0.75758183",
"0.75758183",
"0.75758183",
"0.74546975",
"0.744609",
"0.744609",
"0.74454",
"0.74454",
"0.74454",
"0.74454",
"0.74454",
"0.744... | 0.7185874 | 55 |
Convert the model's attributes to an array. | public function attributesToArray()
{
$attributes = $this->attributes;
$mutatedAttributes = $this->getMutatedAttributes();
// We want to spin through all the mutated attributes for this model and call
// the mutator for the attribute. We cache off every mutated attributes so
// we don't have to constantly check on attributes that actually change.
foreach ($mutatedAttributes as $key) {
if (!array_key_exists($key, $attributes)) {
continue;
}
$attributes[$key] = $this->mutateAttributeForArray(
$key, $attributes[$key]
);
}
// Here we will grab all of the appended, calculated attributes to this model
// as these attributes are not really in the attributes array, but are run
// when we need to array or JSON the model for convenience to the coder.
foreach ($this->getArrayableAppends() as $key) {
$attributes[$key] = $this->mutateAttributeForArray($key, null);
}
return $attributes;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function attributesToArray()\n {\n $attributes = $this->getArrayableAttributes();\n\n return $attributes;\n }",
"public function toArray()\n {\n return $this->attributesToArray();\n }",
"public function toArray()\n {\n return $this->attributesToArray();\n }"... | [
"0.80428535",
"0.7896457",
"0.7896457",
"0.78604525",
"0.7803931",
"0.77749693",
"0.77749693",
"0.77749693",
"0.77749693",
"0.7734881",
"0.77163154",
"0.77087635",
"0.7693619",
"0.7691863",
"0.763805",
"0.7616516",
"0.7616516",
"0.7614991",
"0.7529832",
"0.7518526",
"0.746092... | 0.80184025 | 1 |
Get all of the appendable values that are arrayable. | protected function getArrayableAppends()
{
$defaults = ['settings'];
if (!count($this->appends)) {
return $defaults;
}
return array_merge($defaults, $this->appends);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function getArrayableAppends()\n {\n if (!count($this->appends))\n return [];\n\n return $this->getArrayableItems(\n array_combine($this->appends, $this->appends)\n );\n }",
"protected function getArrayableAppends()\n\t{\n\t\tif(self::$withoutAppends){\n... | [
"0.7508744",
"0.72422355",
"0.69321793",
"0.68003803",
"0.678907",
"0.6783425",
"0.6760019",
"0.6733572",
"0.66122735",
"0.66122735",
"0.66122735",
"0.66122735",
"0.66122735",
"0.66122735",
"0.6548164",
"0.6446483",
"0.6446483",
"0.64455384",
"0.64127076",
"0.636783",
"0.6362... | 0.7204137 | 2 |
Get a plain attribute. | public function getAttribute($key)
{
// Before Event
if (($attr = $this->fireEvent('model.beforeGetAttribute', [$key], true)) !== null) {
return $attr;
}
$value = $this->getAttributeFromArray($key);
// If the attribute has a get mutator, we will call that then return what
// it returns as the value, which is useful for transforming values on
// retrieval from the model to a form that is more useful for usage.
if ($this->hasGetMutator($key)) {
return $this->mutateAttribute($key, $value);
}
// After Event
if (($_attr = $this->fireEvent('model.getAttribute', [$key, $attr], true)) !== null) {
return $_attr;
}
return $value;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getAttribute(string $attribute): string;",
"public function getAttr(): string\r\n {\r\n return $this->attr;\r\n }",
"public function getAttribute(): string\n {\n return $this->attribute;\n }",
"public function getIdentifyingAttribute();",
"public function get($attr... | [
"0.7258921",
"0.715107",
"0.7112046",
"0.7079923",
"0.7025909",
"0.6914427",
"0.68775004",
"0.684036",
"0.684036",
"0.68111414",
"0.6805041",
"0.67985743",
"0.67982066",
"0.6755392",
"0.6750193",
"0.6712033",
"0.67109144",
"0.67087054",
"0.6690986",
"0.66888374",
"0.66766447"... | 0.0 | -1 |
Get an attribute from the $attributes array. | protected function getAttributeFromArray($key)
{
if (array_key_exists($key, $this->attributes)) {
return $this->attributes[$key];
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function __get($attribute)\n {\n return array_get($this->attributes, $attribute);\n }",
"public function __get($attribute)\n {\n if ( isset($this->attributes[$attribute]) ) return $this->attributes[$attribute];\n }",
"public function get($attribute);",
"public function getAtt... | [
"0.72491",
"0.68765575",
"0.6843601",
"0.6758843",
"0.6733515",
"0.66935533",
"0.6678788",
"0.6601271",
"0.65416783",
"0.6533229",
"0.65319824",
"0.6495795",
"0.6488818",
"0.6457798",
"0.64456236",
"0.6427168",
"0.642036",
"0.6388759",
"0.63680077",
"0.63577133",
"0.63506186"... | 0.6207074 | 40 |
Determine if a get mutator exists for an attribute. | public function hasGetMutator($key)
{
return $this->methodExists('get'.Str::studly($key).'Attribute');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function hasGetMutator($key)\n {\n return method_exists($this, 'get' . Str::studly($key) . 'Attribute');\n }",
"public function hasGetMutator($key)\n {\n return method_exists($this, 'get' . studly_case($key) . 'Attribute');\n }",
"public function hasGetMutator($key)\n {\n ... | [
"0.7768784",
"0.77530867",
"0.7690894",
"0.7690894",
"0.7635883",
"0.75039136",
"0.72599494",
"0.711803",
"0.65001476",
"0.64817536",
"0.6368092",
"0.63547635",
"0.6345683",
"0.6345683",
"0.6326818",
"0.62785614",
"0.6278046",
"0.62641793",
"0.6239149",
"0.62237495",
"0.61550... | 0.7816478 | 0 |
Get the value of an attribute using its mutator. | protected function mutateAttribute($key, $value)
{
return $this->{'get'.Str::studly($key).'Attribute'}($value);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function getValueAttribute() {}",
"public function getAttribute($key)\n {\n $value = $this->getAttributeValue($key);\n\n // First we will check for the presence of a mutator for the set operation\n // which simply lets the developers tweak the attribute as it is set.\n if... | [
"0.68495345",
"0.661161",
"0.65844136",
"0.6577312",
"0.6557404",
"0.655217",
"0.6447143",
"0.6400954",
"0.6361808",
"0.63159263",
"0.63065463",
"0.6277778",
"0.6277778",
"0.6191973",
"0.61884415",
"0.6176769",
"0.61404353",
"0.6088523",
"0.6080024",
"0.6064639",
"0.605968",
... | 0.5849656 | 45 |
Get the value of an attribute using its mutator for array conversion. | protected function mutateAttributeForArray($key, $value)
{
$value = $this->mutateAttribute($key, $value);
return $value instanceof Arrayable ? $value->toArray() : $value;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function getValueAttribute() {}",
"public function __get($name)\n {\n $attribute = parent::__get($name);\n if ($name == 'values' && $attribute) {\n return $attribute[0]['value'];\n }\n return $attribute;\n }",
"public function __get($attribute)\n {\n ... | [
"0.693335",
"0.66888875",
"0.6461216",
"0.64513874",
"0.6390669",
"0.63683414",
"0.60958546",
"0.60728246",
"0.60693884",
"0.6058542",
"0.605457",
"0.6037888",
"0.6026632",
"0.5992204",
"0.59782696",
"0.5973587",
"0.59735066",
"0.5949071",
"0.5946819",
"0.59147197",
"0.591096... | 0.0 | -1 |
Set a given attribute on the model. | public function setAttribute($key, $value)
{
// Before Event
if (($_value = $this->fireEvent('model.beforeSetAttribute', [$key, $value], true)) !== null) {
$value = $_value;
}
// First we will check for the presence of a mutator for the set operation
// which simply lets the developers tweak the attribute as it is set on
// the model, such as "json_encoding" an listing of data for storage.
if ($this->hasSetMutator($key)) {
$method = 'set'.Str::studly($key).'Attribute';
// If we return the returned value of the mutator call straight away, that will disable the firing of
// 'model.setAttribute' event, and then no third party plugins will be able to implement any kind of
// post processing logic when an attribute is set with explicit mutators. Returning from the mutator
// call will also break method chaining as intended by returning `$this` at the end of this method.
$this->{$method}($value);
}
else {
$this->attributes[$key] = $value;
}
// After Event
$this->fireEvent('model.setAttribute', [$key, $value]);
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function __set($attribute, $param) {\n $this->$attribute = $param;\n }",
"public function __set($attribute, $value){\n\t\t$this->$attribute = $value;\n\t}",
"public function setAttribute(string $attribute, string $value);",
"public function __set($attribute, $value) {\n $this-... | [
"0.76855254",
"0.766302",
"0.7508671",
"0.74314046",
"0.7416725",
"0.73780745",
"0.7357619",
"0.7338746",
"0.72974455",
"0.7246165",
"0.72431934",
"0.7210178",
"0.7206504",
"0.7199687",
"0.71688366",
"0.71502733",
"0.6981605",
"0.6944696",
"0.6931927",
"0.69077706",
"0.684472... | 0.65197396 | 36 |
Determine if a set mutator exists for an attribute. | public function hasSetMutator($key)
{
return $this->methodExists('set'.Str::studly($key).'Attribute');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function hasSetMutator($key)\n {\n return method_exists($this, 'set' . Str::studly($key) . 'Attribute');\n }",
"public function hasSetMutator($key)\n {\n return method_exists($this, 'set' . studly_case($key) . 'Attribute');\n }",
"public function hasSetMutator($key)\n {\n ... | [
"0.7262567",
"0.72312343",
"0.7197799",
"0.7197799",
"0.6677842",
"0.664554",
"0.6518645",
"0.65154284",
"0.64689076",
"0.64689076",
"0.64452624",
"0.62474126",
"0.6231419",
"0.62125957",
"0.6177204",
"0.6177204",
"0.61649835",
"0.6161747",
"0.6148717",
"0.61353886",
"0.61332... | 0.7232248 | 1 |
Get all of the current attributes on the model. | public function getAttributes()
{
return $this->attributes;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function all()\n\t{\n\t\treturn $this->attributes;\n\t}",
"public function getModelAttributes()\n {\n return $this->model->getAttributes();\n }",
"public function attributes()\n {\n return $this->activeAttributes();\n }",
"function attributes() {\n\t\t$this->load_attributes()... | [
"0.82305926",
"0.80878913",
"0.8085684",
"0.80186427",
"0.7821868",
"0.7808438",
"0.77517354",
"0.77345043",
"0.77345043",
"0.7730291",
"0.7721688",
"0.7698713",
"0.76920563",
"0.76871777",
"0.76871777",
"0.7687157",
"0.76759857",
"0.7670685",
"0.76664263",
"0.7588164",
"0.75... | 0.77108544 | 27 |
Set the array of model attributes. No checking is done. | public function setRawAttributes(array $attributes, $sync = false)
{
// merge dynamic properties to the base attributes
if ($sync) {
$attributes = array_merge($this->attributes, $attributes);
}
$this->attributes = $attributes;
if ($sync) {
$this->syncOriginal();
}
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setAttributes();",
"public function setAttributes(array $attributes);",
"public function setAttributes(array $attributes);",
"public function setAttributes(array $attributes);",
"public function setAttributes($arr) {\n foreach($arr as $key => $val) {\n switch($key) {\n case \... | [
"0.7478687",
"0.7472387",
"0.7472387",
"0.7472387",
"0.7045413",
"0.685604",
"0.6740626",
"0.67223793",
"0.670339",
"0.6677488",
"0.6658305",
"0.65901446",
"0.65852576",
"0.6581184",
"0.6571815",
"0.65355766",
"0.650922",
"0.6506179",
"0.65045655",
"0.6501468",
"0.64682156",
... | 0.0 | -1 |
Get the model's original attribute values. | public function getOriginal($key = null, $default = null)
{
return Arr::get($this->original, $key, $default);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function backupOriginalAttributes()\n {\n $this->backup_original = $this->getRawOriginal() ?: [];\n\n return $this->getOriginal();\n }",
"public function getUnchangedAttributes()\n {\n $output = array();\n\n foreach ($this->attributes as $name => $value) {\n ... | [
"0.78856134",
"0.73431104",
"0.7183134",
"0.71351904",
"0.7073124",
"0.70482856",
"0.6953721",
"0.6931459",
"0.6920631",
"0.6911287",
"0.6798541",
"0.67981696",
"0.6792991",
"0.6732015",
"0.6680729",
"0.6561729",
"0.6522301",
"0.6440069",
"0.64344627",
"0.64179194",
"0.641706... | 0.0 | -1 |
Sync the original attributes with the current. | public function syncOriginal()
{
$this->original = $this->attributes;
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"final public function sync() {\n\t\t$this->original = $this->attributes;\n\n\t\treturn true;\n\t}",
"public function syncOriginal()\n {\n $this->original = $this->toArray();\n\n return $this;\n }",
"public function syncOriginal(): Model\n {\n $this->original = $this->getAttributes... | [
"0.74845415",
"0.680344",
"0.6802746",
"0.6786014",
"0.63640785",
"0.63399667",
"0.63048583",
"0.60904676",
"0.6056318",
"0.6033761",
"0.590117",
"0.5896081",
"0.589403",
"0.5851019",
"0.58411443",
"0.5820354",
"0.5798619",
"0.5727194",
"0.57045454",
"0.5635495",
"0.56159526"... | 0.74856496 | 0 |
Sync a single original attribute with its current value. | public function syncOriginalAttribute($attribute)
{
$this->original[$attribute] = $this->attributes[$attribute];
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"final public function sync() {\n\t\t$this->original = $this->attributes;\n\n\t\treturn true;\n\t}",
"public function syncOriginal()\n {\n $this->original = $this->attributes;\n\n return $this;\n }",
"public function syncOriginalAttribute(string $attribute): Model\n {\n return $thi... | [
"0.6735541",
"0.64017737",
"0.63092816",
"0.6272924",
"0.6106774",
"0.5659271",
"0.56214356",
"0.5590092",
"0.5521869",
"0.5507411",
"0.5492286",
"0.546862",
"0.54089236",
"0.5399785",
"0.53850245",
"0.53487664",
"0.532935",
"0.53268903",
"0.53224164",
"0.53037477",
"0.528034... | 0.6416313 | 1 |
Determine if the model or given attribute(s) have been modified. | public function isDirty($attributes = null)
{
$dirty = $this->getDirty();
if (is_null($attributes)) {
return count($dirty) > 0;
}
if (!is_array($attributes)) {
$attributes = func_get_args();
}
foreach ($attributes as $attribute) {
if (array_key_exists($attribute, $dirty)) {
return true;
}
}
return false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function isModified() {\n return count($this->modifiedAttributes) > 0;\n }",
"public function isModified();",
"public function isDirty(): bool\n {\n return count($this->changedAttributesName()) > 0;\n }",
"public function isModified(): bool;",
"function isModified() {\n\t\t$mo... | [
"0.7909992",
"0.750378",
"0.7289874",
"0.7231672",
"0.7217978",
"0.7217978",
"0.7167217",
"0.7163574",
"0.7080674",
"0.7080674",
"0.70515615",
"0.70515615",
"0.70515615",
"0.70515615",
"0.70487374",
"0.70487374",
"0.70487374",
"0.70487374",
"0.70487374",
"0.70487374",
"0.7048... | 0.0 | -1 |
Get the attributes that have been changed since last sync. | public function getDirty()
{
$dirty = [];
foreach ($this->attributes as $key => $value) {
if (!array_key_exists($key, $this->original)) {
$dirty[$key] = $value;
}
elseif (
$value !== $this->original[$key] &&
!$this->originalIsNumericallyEquivalent($key)
) {
$dirty[$key] = $value;
}
}
return $dirty;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getChangedAttributes()\n {\n $output = array();\n\n foreach ($this->attributes as $name => $value) {\n if ($this->hasChanged($name)) {\n $output[$name] = $value;\n }\n }\n\n return $output;\n }",
"public function getOldAttribu... | [
"0.7678346",
"0.73805124",
"0.7351105",
"0.7186306",
"0.71703416",
"0.6939382",
"0.6902964",
"0.68494815",
"0.6723025",
"0.6686933",
"0.6668847",
"0.66662854",
"0.6656645",
"0.66436267",
"0.66390693",
"0.66353935",
"0.6631507",
"0.66248626",
"0.6601305",
"0.6582987",
"0.65505... | 0.6867197 | 7 |
Determine if the new and old values for a given key are numerically equivalent. | protected function originalIsNumericallyEquivalent($key)
{
$current = $this->attributes[$key];
$original = $this->original[$key];
return is_numeric($current) && is_numeric($original) && strcmp((string) $current, (string) $original) === 0;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function originalIsNumericallyEquivalent($key)\n {\n $current = $this->attributes[$key];\n $original = $this->original[$key];\n\n // Date comparison.\n if (in_array($key, $this->getDates())) {\n $current = $current instanceof Timestamp ? $this->asDateTime($curren... | [
"0.7722886",
"0.60779005",
"0.545446",
"0.53319126",
"0.5328782",
"0.5290431",
"0.51420885",
"0.51365614",
"0.5067573",
"0.5048477",
"0.49768052",
"0.49618724",
"0.49539602",
"0.49462232",
"0.49450853",
"0.49256834",
"0.49012312",
"0.48968127",
"0.48750275",
"0.48686787",
"0.... | 0.72838795 | 1 |
Delete the model from the database. | public function delete()
{
if (is_null($this->fileName)) {
throw new Exception('No file name (fileName) defined on model.');
}
if ($this->exists) {
if ($this->fireModelEvent('deleting') === false) {
return false;
}
$this->performDeleteOnModel();
$this->exists = false;
// Once the model has been deleted, we will fire off the deleted event so that
// the developers may hook into post-delete operations. We will then return
// a boolean true as the delete is presumably successful on the database.
$this->fireModelEvent('deleted', false);
return true;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public abstract function deleteModel(\\MPF\\Db\\Model $model);",
"public function delete(Model $model);",
"public function delete(Model $model);",
"public function delete()\n {\n Db::getInstance()->delete($this->getTableName(), ['id' => $this->getId()]);\n }",
"public function delete(Model $mo... | [
"0.7884068",
"0.76663375",
"0.76663375",
"0.7511067",
"0.7430471",
"0.7379083",
"0.7269651",
"0.7253018",
"0.7249288",
"0.7198745",
"0.71976167",
"0.7179531",
"0.7151565",
"0.715066",
"0.7120851",
"0.7119418",
"0.71160567",
"0.7091822",
"0.7062709",
"0.70482004",
"0.70369965"... | 0.0 | -1 |
Perform the actual delete query on this model instance. | protected function performDeleteOnModel()
{
$this->newQuery()->delete($this->fileName);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function delete() {\n global $DB;\n $DB->delete_records($this->get_table_name(), array('id' => $this->id));\n }",
"public function __doDelete()\n {\n $strSQL = $this->getDeleteSql();\n $result = $this->query($strSQL);\n }",
"public function delete() {\n $q... | [
"0.71934223",
"0.71915287",
"0.7101852",
"0.7093625",
"0.7043724",
"0.7042221",
"0.704104",
"0.7027212",
"0.7018903",
"0.69623333",
"0.6957784",
"0.6942512",
"0.6935427",
"0.6882916",
"0.6881946",
"0.68719965",
"0.68640006",
"0.68636906",
"0.6856066",
"0.683373",
"0.68243545"... | 0.70006824 | 9 |
Create a new native event for handling beforeFetch(). | public static function fetching($callback)
{
static::registerModelEvent('fetching', $callback);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function preFetch(FetchEvent $event) {\n $GLOBALS['feeds_test_events'][] = (__METHOD__ . ' called');\n }",
"public function postFetch(FetchEvent $event) {\n $GLOBALS['feeds_test_events'][] = (__METHOD__ . ' called');\n }",
"public function setSourceFetchEvent(&$var)\n {\n GPBUtil::chec... | [
"0.6717409",
"0.61490804",
"0.5810147",
"0.56868744",
"0.5652805",
"0.55649334",
"0.5541097",
"0.5536042",
"0.552276",
"0.5460399",
"0.54015803",
"0.5361719",
"0.5311925",
"0.5267384",
"0.5264769",
"0.5233638",
"0.51955706",
"0.5192409",
"0.51699996",
"0.515664",
"0.5086662",... | 0.4739489 | 57 |
Create a new native event for handling afterFetch(). | public static function fetched($callback)
{
static::registerModelEvent('fetched', $callback);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function postFetch(FetchEvent $event) {\n $GLOBALS['feeds_test_events'][] = (__METHOD__ . ' called');\n }",
"public function preFetch(FetchEvent $event) {\n $GLOBALS['feeds_test_events'][] = (__METHOD__ . ' called');\n }",
"public function onEvent();",
"public function getEventDispatch();",
... | [
"0.66770947",
"0.5849421",
"0.5740588",
"0.559159",
"0.5548758",
"0.55205244",
"0.5416467",
"0.5381586",
"0.5381523",
"0.5378508",
"0.53685445",
"0.5274704",
"0.524929",
"0.52185845",
"0.5216299",
"0.52126694",
"0.517701",
"0.51655966",
"0.51477677",
"0.514372",
"0.51234084",... | 0.52568674 | 12 |
Register a saving model event with the dispatcher. | public static function saving($callback, $priority = 0)
{
static::registerModelEvent('saving', $callback, $priority);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function saved($model)\n {\n }",
"public function saving($model)\n {\n }",
"public function saved(Request $model)\n {\n if($model->isDirty($model->getStatusFieldName())){\n $this->recordHistory($model);\n $this->fireStatusEvent($model);\n }\n # P... | [
"0.6438325",
"0.6411021",
"0.6326963",
"0.6324801",
"0.63191456",
"0.6296617",
"0.6233157",
"0.6112213",
"0.60999864",
"0.6091059",
"0.60501283",
"0.6040872",
"0.6026271",
"0.6013151",
"0.6005255",
"0.59395146",
"0.5853004",
"0.5838897",
"0.57907546",
"0.5782817",
"0.57782614... | 0.6145208 | 7 |
Register a saved model event with the dispatcher. | public static function saved($callback, $priority = 0)
{
static::registerModelEvent('saved', $callback, $priority);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function registerDocumentModelEvent(ModelEvent $event)\n {\n if (!$this->enabled) {\n return;\n }\n if ((!($dbEvents = $this->getConfigValue('database', 'array')))) {\n return;\n }\n if (!in_array($event->getAction(), $dbEvents)) {\n ret... | [
"0.62092125",
"0.61309016",
"0.6070825",
"0.60432816",
"0.59615713",
"0.5932077",
"0.5797198",
"0.5778074",
"0.570524",
"0.5701168",
"0.5624102",
"0.55844367",
"0.5566649",
"0.5544086",
"0.552783",
"0.5470068",
"0.54608333",
"0.54426664",
"0.5440202",
"0.54366744",
"0.5431539... | 0.5833526 | 6 |
Register an updating model event with the dispatcher. | public static function updating($callback, $priority = 0)
{
static::registerModelEvent('updating', $callback, $priority);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function updated($model)\n {\n }",
"public function updated(Registration $model)\n {\n if($model->isDirty('email')){\n # Fire the events\n $this->fireStatusEvents($model);\n }\n }",
"public function updating($model)\n\t{\n\t}",
"public function updatedMo... | [
"0.6720222",
"0.6386654",
"0.6356044",
"0.59835356",
"0.59458",
"0.58643824",
"0.5845092",
"0.58243775",
"0.5740627",
"0.5693835",
"0.56709296",
"0.5657369",
"0.5653719",
"0.56264603",
"0.56129426",
"0.55962783",
"0.55836976",
"0.5575376",
"0.55735725",
"0.5547792",
"0.553717... | 0.5768684 | 8 |
Register an updated model event with the dispatcher. | public static function updated($callback, $priority = 0)
{
static::registerModelEvent('updated', $callback, $priority);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function updated($model)\n {\n }",
"public function updated(Registration $model)\n {\n if($model->isDirty('email')){\n # Fire the events\n $this->fireStatusEvents($model);\n }\n }",
"public function getModelEvents();",
"public function updatedModel(Model... | [
"0.6448649",
"0.63448995",
"0.6059758",
"0.6022907",
"0.59118193",
"0.58293307",
"0.5804914",
"0.56540054",
"0.56285477",
"0.5523784",
"0.5517744",
"0.55161154",
"0.55095506",
"0.54950744",
"0.5493297",
"0.54638153",
"0.5446909",
"0.5382243",
"0.5380946",
"0.53730845",
"0.534... | 0.5525456 | 9 |
Register a creating model event with the dispatcher. | public static function creating($callback, $priority = 0)
{
static::registerModelEvent('creating', $callback, $priority);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function onModelCreated()\n {\n if ($this->addLeaf != null) {\n $this->addLeaf->setName(\"Add\");\n $this->model->addLeaf = $this->addLeaf;\n }\n\n // Hook up the event handler that returns a selection item for a given model.\n $this->model->getItemFor... | [
"0.62676495",
"0.60582256",
"0.59932345",
"0.59654623",
"0.5920844",
"0.5899051",
"0.5807854",
"0.58029044",
"0.57614404",
"0.5757084",
"0.5735723",
"0.57191336",
"0.567064",
"0.5658227",
"0.56124693",
"0.56108236",
"0.5609828",
"0.55951476",
"0.55862224",
"0.5584507",
"0.555... | 0.5438928 | 30 |
Register a created model event with the dispatcher. | public static function created($callback, $priority = 0)
{
static::registerModelEvent('created', $callback, $priority);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function onModelCreated()\n {\n if ($this->addLeaf != null) {\n $this->addLeaf->setName(\"Add\");\n $this->model->addLeaf = $this->addLeaf;\n }\n\n // Hook up the event handler that returns a selection item for a given model.\n $this->model->getItemFor... | [
"0.64774287",
"0.6262918",
"0.6113943",
"0.590242",
"0.588557",
"0.58444417",
"0.57075745",
"0.56597155",
"0.5632678",
"0.55553985",
"0.55182666",
"0.54296345",
"0.54230934",
"0.5360697",
"0.5326727",
"0.5304289",
"0.5304183",
"0.53002065",
"0.52833647",
"0.52793735",
"0.5263... | 0.5302443 | 17 |
Register a deleting model event with the dispatcher. | public static function deleting($callback, $priority = 0)
{
static::registerModelEvent('deleting', $callback, $priority);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function delete($event): void;",
"public function delete(RegistrationPostDeletedEvent $event): void\n {\n }",
"public function onModelDeleted($model)\r\n {\r\n $this->onModelSaved($model);\r\n }",
"public function delete(Identifiable $model);",
"public function delete($model);",
... | [
"0.6984278",
"0.6961776",
"0.67035615",
"0.65241295",
"0.65158147",
"0.65027523",
"0.6490272",
"0.6429676",
"0.63552505",
"0.63378984",
"0.6317148",
"0.6308893",
"0.6308893",
"0.62908566",
"0.62884426",
"0.626652",
"0.6250017",
"0.62000376",
"0.61680466",
"0.61614186",
"0.615... | 0.6220237 | 17 |
Register a deleted model event with the dispatcher. | public static function deleted($callback, $priority = 0)
{
static::registerModelEvent('deleted', $callback, $priority);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function onModelDeleted($model)\r\n {\r\n $this->onModelSaved($model);\r\n }",
"public function delete(RegistrationPostDeletedEvent $event): void\n {\n }",
"public function onBeforeDelete();",
"public function deleted(Auditable $model)\n {\n Auditor::execute($model->setAud... | [
"0.6865375",
"0.6831504",
"0.6692741",
"0.6684159",
"0.65676033",
"0.65424883",
"0.64742965",
"0.6440437",
"0.64119697",
"0.638705",
"0.63845944",
"0.6310099",
"0.6307518",
"0.62501717",
"0.62064314",
"0.62049645",
"0.6196612",
"0.61641777",
"0.61305994",
"0.61250633",
"0.608... | 0.6556022 | 5 |
Remove all of the event listeners for the model. | public static function flushEventListeners()
{
if (!isset(static::$dispatcher)) {
return;
}
$instance = new static;
foreach ($instance->getObservableEvents() as $event) {
static::$dispatcher->forget("halcyon.{$event}: ".get_called_class());
}
static::$eventsBooted = [];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function clearListeners()\n {\n $this->listeners = array();\n }",
"protected function flushModelEventListeners()\n {\n foreach (get_declared_classes() as $class) {\n if ($class == 'October\\Rain\\Database\\Pivot') {\n continue;\n }\n\n ... | [
"0.72185004",
"0.7038131",
"0.6562188",
"0.6499303",
"0.62880194",
"0.62850404",
"0.62729406",
"0.62289345",
"0.6173481",
"0.6137445",
"0.6128501",
"0.60808",
"0.6031795",
"0.5940962",
"0.5936264",
"0.5921797",
"0.5897268",
"0.58515596",
"0.5838792",
"0.57996774",
"0.5750365"... | 0.6484137 | 4 |
Register a model event with the dispatcher. | protected static function registerModelEvent($event, $callback, $priority = 0)
{
if (isset(static::$dispatcher)) {
$name = get_called_class();
static::$dispatcher->listen("halcyon.{$event}: {$name}", $callback, $priority);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getModelEvents();",
"public function registerDocumentModelEvent(ModelEvent $event)\n {\n if (!$this->enabled) {\n return;\n }\n if ((!($dbEvents = $this->getConfigValue('database', 'array')))) {\n return;\n }\n if (!in_array($event->getA... | [
"0.6501016",
"0.6453853",
"0.60835004",
"0.60735255",
"0.6029853",
"0.56127524",
"0.55811983",
"0.5530698",
"0.54611063",
"0.5442325",
"0.54347765",
"0.5424129",
"0.5386761",
"0.53820634",
"0.53743255",
"0.53215265",
"0.5313584",
"0.5302551",
"0.5290838",
"0.5286662",
"0.5283... | 0.6459546 | 1 |
Get the observable event names. | public function getObservableEvents()
{
return array_merge(
[
'creating', 'created', 'updating', 'updated',
'deleting', 'deleted', 'saving', 'saved',
'fetching', 'fetched'
],
$this->observables
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getEventNames()\n {\n return array_keys($this->events);\n }",
"public function getEventNames(){\n return array($this->getEventName() => array($this,'handle'));\n }",
"public function getEventNames()/*# : array */;",
"public static function getEventNames()\n {\n retu... | [
"0.80881095",
"0.76815116",
"0.72184455",
"0.7161904",
"0.6969799",
"0.6714642",
"0.6537803",
"0.62656206",
"0.6222253",
"0.6215524",
"0.61963713",
"0.61963713",
"0.6186284",
"0.6186284",
"0.6173764",
"0.61511827",
"0.60638374",
"0.604934",
"0.60394394",
"0.60286486",
"0.6024... | 0.71322787 | 4 |
Set the observable event names. | public function setObservableEvents(array $observables)
{
$this->observables = $observables;
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function event_names($users)\r\n\t{\r\n\t\t$this->names = array_merge($this->names, explode(' ', $users));\r\n\t}",
"public function getEventNames(){\n return array($this->getEventName() => array($this,'handle'));\n }",
"public function setNames($names) {\n $this->_names = $names;\n }",
"publi... | [
"0.6439292",
"0.605857",
"0.60171676",
"0.58845115",
"0.57914764",
"0.55273974",
"0.5494641",
"0.5484149",
"0.5345384",
"0.531082",
"0.52891016",
"0.5221481",
"0.5165873",
"0.5154284",
"0.5110506",
"0.5070509",
"0.5065553",
"0.50646555",
"0.5062642",
"0.50524145",
"0.5016903"... | 0.5525668 | 6 |
Add an observable event name. | public function addObservableEvents($observables)
{
$observables = is_array($observables) ? $observables : func_get_args();
$this->observables = array_unique(array_merge($this->observables, $observables));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function pushEvent($name)\n {\n $this->data['event'] = $name;\n }",
"public function getCustomEventName();",
"public function name(): string\n {\n return 'event';\n }",
"protected function getName()\n\t{\n\t\treturn 'event';\n\t}",
"public function getName()\n {\n ... | [
"0.62884367",
"0.612888",
"0.5704643",
"0.5648721",
"0.56429285",
"0.5596596",
"0.54783595",
"0.54553276",
"0.5444087",
"0.5309349",
"0.5262376",
"0.52506554",
"0.5231878",
"0.5218101",
"0.5214587",
"0.5147239",
"0.5108691",
"0.5099752",
"0.5084807",
"0.507079",
"0.50598776",... | 0.47629637 | 37 |
Remove an observable event name. | public function removeObservableEvents($observables)
{
$observables = is_array($observables) ? $observables : func_get_args();
$this->observables = array_diff($this->observables, $observables);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function removeEvent($event);",
"public function remove($name = null)\r\n {\r\n if (null === $name) {\r\n $this->_events = array();\r\n } else {\r\n $name = strtolower($name);\r\n if (isset($this->_events[$name])) {\r\n unset($this->_events[... | [
"0.6761382",
"0.65801764",
"0.65038204",
"0.6314531",
"0.62676185",
"0.61617386",
"0.6142246",
"0.6142246",
"0.6142246",
"0.6142246",
"0.6142246",
"0.6142246",
"0.61364895",
"0.6100873",
"0.60754365",
"0.59819597",
"0.5958885",
"0.59501183",
"0.59499377",
"0.5927891",
"0.5927... | 0.0 | -1 |
Update the model in the database. | public function update(array $attributes = [])
{
if (!$this->exists) {
return $this->newQuery()->update($attributes);
}
return $this->fill($attributes)->save();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function update()\n\t{\n\t\t$this->getModel()->update($this);\n\t}",
"function update(){\n\t\t$this->model->update();\n\t}",
"protected function update() {\n if ($this->_isLoaded()) {\n $this->db->where('id', $this->id);\n $this->db->update($this->tableName, $this->mapToData... | [
"0.822013",
"0.8215936",
"0.80111283",
"0.7817097",
"0.7592092",
"0.7171988",
"0.71149844",
"0.7064558",
"0.703368",
"0.7032866",
"0.7001174",
"0.6990207",
"0.69881356",
"0.6983201",
"0.69691366",
"0.6968232",
"0.69657665",
"0.68320507",
"0.6762098",
"0.6696608",
"0.6650795",... | 0.0 | -1 |
Save the model to the datasource. | public function save(array $options = null)
{
return $this->saveInternal(['force' => false] + (array) $options);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function save()\n {\n $this->_validateModifiable();\n\n if($this->isNew())\n {\n $this->_getDataSource()->create($this);\n }\n else\n {\n $this->_getDataSource()->update($this);\n }\n\n $this->_saveRelations();\n $this->_setNew(false);\n }",
"public function save(): ... | [
"0.7687302",
"0.70673543",
"0.70123863",
"0.6893411",
"0.67907876",
"0.6784066",
"0.6681013",
"0.6654158",
"0.6654158",
"0.66518784",
"0.66488343",
"0.66446275",
"0.6637515",
"0.6623977",
"0.6616314",
"0.6559563",
"0.6528818",
"0.65250874",
"0.6513197",
"0.65117586",
"0.65032... | 0.0 | -1 |
Finish processing on a successful save operation. | protected function finishSave(array $options)
{
$this->fireModelEvent('saved', false);
$this->mtime = $this->newQuery()->lastModified();
$this->syncOriginal();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function finishSave()\n {\n $this->fireModelEvent('saved', false);\n $this->syncOriginal();\n }",
"public final function save() {\n }",
"public function finish()\n {\n $this->status = 'finished';\n return $this->save();\n }",
"public final function sav... | [
"0.79957986",
"0.69992757",
"0.6968752",
"0.6951618",
"0.690518",
"0.6836143",
"0.6771868",
"0.6771868",
"0.6759366",
"0.6671879",
"0.6656088",
"0.6648237",
"0.664154",
"0.6626604",
"0.66047215",
"0.65999305",
"0.6586653",
"0.6572289",
"0.6554298",
"0.6505385",
"0.6501422",
... | 0.62870497 | 40 |
Perform a model update operation. | protected function performUpdate(Builder $query, array $options = [])
{
$dirty = $this->getDirty();
if (count($dirty) > 0) {
// If the updating event returns false, we will cancel the update operation so
// developers can hook Validation systems into their models and cancel this
// operation if the model does not pass validation. Otherwise, we update.
if ($this->fireModelEvent('updating') === false) {
return false;
}
$dirty = $this->getDirty();
if (count($dirty) > 0) {
$numRows = $query->update($dirty);
$this->fireModelEvent('updated', false);
}
}
return true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function update(){\n\t\t$this->model->update();\n\t}",
"public function update()\n\t{\n\t\t$this->getModel()->update($this);\n\t}",
"abstract protected function updateModel();",
"public function update($model) :bool;",
"public function updating($model)\n\t{\n\t}",
"public function testUpdate()\n {\n ... | [
"0.7764393",
"0.76994836",
"0.7650558",
"0.7601129",
"0.7513205",
"0.75078285",
"0.7452994",
"0.74213344",
"0.7367324",
"0.72897035",
"0.72132003",
"0.71370524",
"0.7030996",
"0.70020926",
"0.6963688",
"0.6922468",
"0.6922468",
"0.69050246",
"0.6845271",
"0.6845271",
"0.67659... | 0.0 | -1 |
Perform a model insert operation. | protected function performInsert(Builder $query, array $options = [])
{
if ($this->fireModelEvent('creating') === false) {
return false;
}
// Ensure the settings attribute is passed through so this distinction
// is recognised, mainly by the processor.
$attributes = $this->attributesToArray();
$query->insert($attributes);
// We will go ahead and set the exists property to true, so that it is set when
// the created event is fired, just in case the developer tries to update it
// during the event. This will allow them to do so and run an update here.
$this->exists = true;
$this->fireModelEvent('created', false);
return true;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function insert()\n\t{\n\t\treturn $this->getModel()->insert($this);\n\t}",
"public function insert() {\r\n\t\t$this->getMapper()->insert($this);\r\n\t}",
"protected function saveInsert()\n {\n }",
"public function insert() {\n \n }",
"public function insert()\n {\n $this->... | [
"0.7666964",
"0.75712323",
"0.72754806",
"0.7135534",
"0.70756435",
"0.7072083",
"0.70537406",
"0.70509773",
"0.70509773",
"0.70383924",
"0.69955003",
"0.69955003",
"0.6954634",
"0.6888122",
"0.68806684",
"0.68710756",
"0.6864208",
"0.68539006",
"0.6850599",
"0.6836991",
"0.6... | 0.0 | -1 |
Fire the given event for the model. | protected function fireModelEvent($event, $halt = true)
{
if (!isset(static::$dispatcher)) {
return true;
}
// We will append the names of the class to the event to distinguish it from
// other model events that are fired, allowing us to listen on each model
// event set individually instead of catching event for all the models.
$event = "halcyon.{$event}: ".get_class($this);
$method = $halt ? 'until' : 'fire';
return static::$dispatcher->$method($event, $this);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function fireModelEvent(Event $event)\n {\n static::getEventDispatcher()->fire($event);\n }",
"protected function fire_event($event) {\n\t\t$events = array(\"eloquent.{$event}\", \"eloquent.{$event}: \".get_class($this));\n\n\t\tEvent::fire($events, array($this));\n\t}",
"public function... | [
"0.73562884",
"0.67179745",
"0.6574197",
"0.64441276",
"0.636817",
"0.6339298",
"0.6059989",
"0.5947686",
"0.58663374",
"0.5854746",
"0.58448344",
"0.58448344",
"0.57933116",
"0.57921153",
"0.57545984",
"0.5752188",
"0.5709562",
"0.56605446",
"0.5610619",
"0.5584932",
"0.5563... | 0.57273823 | 16 |
Get a new query builder for the object | public function newQuery()
{
$datasource = $this->getDatasource();
$query = new Builder($datasource, $datasource->getPostProcessor());
return $query->setModel($this);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function createQueryBuilder ()\r\n {\r\n return new QueryBuilder($this);\r\n }",
"public function newQuery()\n {\n return new Builder($this->connection, $this->processor);\n }",
"public function queryBuilder();",
"public function queryBuilder();",
"public function newQuery(... | [
"0.8184689",
"0.80916274",
"0.8077217",
"0.8077217",
"0.8071451",
"0.8038002",
"0.80291265",
"0.79947925",
"0.79740125",
"0.795177",
"0.7896967",
"0.7871272",
"0.78519696",
"0.78504866",
"0.7844036",
"0.78192025",
"0.7756608",
"0.774299",
"0.774299",
"0.77364516",
"0.7735641"... | 0.8071898 | 4 |
Create a new Halcyon Collection instance. | public function newCollection(array $models = [])
{
return new Collection($models);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static function collection()\n {\n return new Collection();\n }",
"public function __construct()\n {\n $this->_collection = new Collection();\n }",
"public function __construct(){\r\n\t\t$this->collection = new Collection();\r\n\t}",
"protected function createCollection()\n {\n re... | [
"0.67218024",
"0.6527431",
"0.64319324",
"0.6352032",
"0.6318654",
"0.6270462",
"0.6270462",
"0.6236317",
"0.612738",
"0.6065921",
"0.60455143",
"0.59790784",
"0.5918718",
"0.59050906",
"0.587401",
"0.587401",
"0.5871156",
"0.5823667",
"0.58107066",
"0.5784722",
"0.5745203",
... | 0.0 | -1 |
Returns the base file name and extension. Applies a default extension, if none found. | public function getFileNameParts($fileName = null)
{
if ($fileName === null) {
$fileName = $this->fileName;
}
if (!strlen($extension = pathinfo($fileName, PATHINFO_EXTENSION))) {
$extension = $this->defaultExtension;
$baseFile = $fileName;
}
else {
$pos = strrpos($fileName, '.');
$baseFile = substr($fileName, 0, $pos);
}
return [$baseFile, $extension];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getDefaultExtension(): string\n {\n return $this->defaultExtension;\n }",
"public function extension($filename, &$base = NULL) {\n\t\t$split = split('\\.', $filename);\n\t\t$last = '';\n\t\t$accum = '';\n\t\tforeach ($split as $str) {\n\t\t\tif ($last) {\n\t\t\t\t$accum .= $last . \"... | [
"0.74614495",
"0.7353801",
"0.7165537",
"0.7159991",
"0.71560484",
"0.710744",
"0.70692104",
"0.7060511",
"0.701692",
"0.69963354",
"0.69733214",
"0.69395614",
"0.6939132",
"0.6891156",
"0.68670905",
"0.6850086",
"0.68484116",
"0.684472",
"0.6822626",
"0.6804455",
"0.6802495"... | 0.0 | -1 |
Get the datasource for the model. | public function getDatasource()
{
return static::resolveDatasource($this->datasource);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function getDataSource()\n {\n /** @var Model $modelClass */\n $modelClass = get_class($this);\n $parentModelName = get_parent_class($modelClass);\n\n if ($parentModelName == Model_Defined::getClass() || $parentModelName == Model_Factory::getClass()) {\n return Data... | [
"0.81560904",
"0.7850819",
"0.7822307",
"0.7822307",
"0.75623393",
"0.75285554",
"0.74616975",
"0.7349357",
"0.73254824",
"0.70100415",
"0.6938118",
"0.6829179",
"0.6781077",
"0.66445446",
"0.6520051",
"0.6385831",
"0.63659734",
"0.63550323",
"0.62827635",
"0.628099",
"0.6253... | 0.7788266 | 4 |
Get the current datasource name for the model. | public function getDatasourceName()
{
return $this->datasource;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public static function getDataSourceName() {\r\n // Example: Use a local SQLite3 database\r\n return 'sqlite:' . dirname(__FILE__) . '/counter.sqlite3';\r\n \r\n // Example use mySQL\r\n // return 'mysql:host=localhost;port=3306;dbname=demo';\r\n }",
"public static function getDataSourceKey()\n ... | [
"0.7160904",
"0.7128389",
"0.7120785",
"0.6970749",
"0.6970749",
"0.686984",
"0.6869673",
"0.6817336",
"0.67749864",
"0.6697576",
"0.65902865",
"0.64754593",
"0.64501506",
"0.644604",
"0.639903",
"0.63811195",
"0.6365092",
"0.63477874",
"0.634556",
"0.63448626",
"0.6340736",
... | 0.8409692 | 0 |
Set the datasource associated with the model. | public function setDatasource($name)
{
$this->datasource = $name;
return $this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setDatasource($datasource)\n {\n $this->datasource = $datasource;\n }",
"public function setDatasource($datasource = NULL)\n {\n\n //If there are no datasource, set it to an empty array\n if($datasource === NULL)\n {\n $datasource = array();\n ... | [
"0.723123",
"0.6307001",
"0.62971985",
"0.62503946",
"0.61088884",
"0.61088884",
"0.60399896",
"0.60399896",
"0.60399896",
"0.60399896",
"0.60141534",
"0.5976137",
"0.5850964",
"0.58423",
"0.58054006",
"0.5754357",
"0.5696098",
"0.56102884",
"0.55735755",
"0.5534674",
"0.5522... | 0.580316 | 15 |
Resolve a datasource instance. | public static function resolveDatasource($datasource = null)
{
return static::$resolver->datasource($datasource);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public static function getDatasourceResolver()\n {\n return static::$resolver;\n }",
"public function getDatasource()\n {\n return static::resolveDatasource($this->datasource);\n }",
"public static function getConnectionResolver();",
"public static function getDataSource()\n {\n ... | [
"0.6254908",
"0.5897958",
"0.5827101",
"0.5559807",
"0.55424845",
"0.55424845",
"0.551143",
"0.54690635",
"0.54495233",
"0.5303409",
"0.53020084",
"0.53020084",
"0.52671164",
"0.5264699",
"0.5243511",
"0.52429086",
"0.52256596",
"0.52160084",
"0.520504",
"0.509803",
"0.508639... | 0.73382974 | 0 |
Get the datasource resolver instance. | public static function getDatasourceResolver()
{
return static::$resolver;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public static function getConnectionResolver()\n {\n return static::$resolver;\n }",
"public static function getConnectionResolver()\n {\n return static::$resolver;\n }",
"public function getConnectionResolver()\n {\n return $this->resolver;\n }",
"public static functio... | [
"0.74746126",
"0.74746126",
"0.73314303",
"0.7196785",
"0.6959201",
"0.6614767",
"0.6291765",
"0.61531407",
"0.61505747",
"0.6123957",
"0.61236215",
"0.6103618",
"0.6086765",
"0.6069854",
"0.6024955",
"0.6020866",
"0.6020866",
"0.5958177",
"0.5931751",
"0.5924971",
"0.5905664... | 0.8466631 | 0 |
Set the datasource resolver instance. | public static function setDatasourceResolver(Resolver $resolver)
{
static::$resolver = $resolver;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public static function setConnectionResolver(Resolver $resolver);",
"public function set_resolver(Resolver $resolver);",
"public static function setConnectionResolver(Resolver $resolver)\n {\n static::$resolver = $resolver;\n }",
"public static function getDatasourceResolver()\n {\n re... | [
"0.70538473",
"0.6986677",
"0.6957359",
"0.6792438",
"0.6722543",
"0.66289234",
"0.66157186",
"0.6512312",
"0.6101639",
"0.5945581",
"0.59298414",
"0.59298414",
"0.589466",
"0.58686596",
"0.58485174",
"0.581797",
"0.57792646",
"0.5719786",
"0.5640163",
"0.5609125",
"0.5604885... | 0.7941913 | 0 |
Unset the datasource resolver for models. | public static function unsetDatasourceResolver()
{
static::$resolver = null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public static function unsetDalResolver()\n {\n static::$_resolver = null;\n }",
"public static function unsetConnectionResolver()\n {\n static::$resolver = null;\n }",
"public static function unsetConnectionResolver()\n {\n static::$resolver = null;\n }",
"public static functi... | [
"0.6991766",
"0.67543536",
"0.67543536",
"0.65499735",
"0.60841894",
"0.5916611",
"0.5754598",
"0.5667877",
"0.5643645",
"0.56382513",
"0.5610049",
"0.5541841",
"0.5490016",
"0.5461307",
"0.5368551",
"0.53546363",
"0.53523505",
"0.5347345",
"0.53370273",
"0.53142",
"0.5304529... | 0.7958001 | 0 |
Get the event dispatcher instance. | public static function getEventDispatcher()
{
return static::$dispatcher;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"protected function getEventDispatcherService()\n {\n if (isset($this->shared['event_dispatcher'])) return $this->shared['event_dispatcher'];\n\n $class = $this->getParameter('event_dispatcher.class');\n $instance = new $class($this);\n $this->shared['event_dispatcher'] = $instance;\n... | [
"0.81160486",
"0.80278236",
"0.79869395",
"0.7969047",
"0.7869225",
"0.785308",
"0.7763506",
"0.77522147",
"0.75496876",
"0.75269914",
"0.7480979",
"0.7477476",
"0.7353422",
"0.72507995",
"0.71986276",
"0.71884865",
"0.71487474",
"0.70782775",
"0.70391905",
"0.70391905",
"0.7... | 0.80964833 | 1 |
Set the event dispatcher instance. | public static function setEventDispatcher(Dispatcher $dispatcher)
{
static::$dispatcher = $dispatcher;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function setEventDispatcher (Dispatcher $dispatcher) {\n $this->container->instance('events', $dispatcher);\n }",
"public function setEventDispatcher(Dispatcher $dispatcher): void\n {\n $this->container->instance('events', $dispatcher);\n }",
"private function configureDispatcher(... | [
"0.77570105",
"0.7520488",
"0.71289533",
"0.7071396",
"0.7070821",
"0.69521385",
"0.692976",
"0.68858975",
"0.6834073",
"0.6815494",
"0.6732975",
"0.67111564",
"0.67082524",
"0.66795456",
"0.6667227",
"0.6597695",
"0.64621615",
"0.6459911",
"0.6430024",
"0.6331454",
"0.628115... | 0.7515415 | 2 |
Unset the event dispatcher for models. | public static function unsetEventDispatcher()
{
static::$dispatcher = null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"public function unsetEventDispatcher()\n {\n $this->events = null;\n }",
"public function unsetDispatcher(): void\n {\n $this->dispatcher = null;\n }",
"public function reset() {\n $this->_events->reset();\n }",
"public function unsetEventTypes(): void\n {\n $thi... | [
"0.7311602",
"0.67983913",
"0.63313633",
"0.62176996",
"0.6075609",
"0.6002631",
"0.58648247",
"0.57652485",
"0.57640064",
"0.57521355",
"0.57027155",
"0.5669808",
"0.5664629",
"0.5622729",
"0.5581341",
"0.55378693",
"0.55290747",
"0.5523264",
"0.552272",
"0.5500164",
"0.5478... | 0.71739745 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.