1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-13 10:15:28 +02:00

DB query updates in WireSaveableItems class

This commit is contained in:
Ryan Cramer
2020-07-10 12:46:55 -04:00
parent 6f4c21d5b9
commit 0cc2bf4b79
2 changed files with 25 additions and 11 deletions

View File

@@ -100,6 +100,9 @@ abstract class WireSaveableItemsLookup extends WireSaveableItems {
* Should the given item key/field be saved in the database?
*
* Template method used by ___save()
*
* @param string $key
* @return bool
*
*/
protected function saveItemKey($key) {
@@ -117,7 +120,10 @@ abstract class WireSaveableItemsLookup extends WireSaveableItems {
*/
public function ___save(Saveable $item) {
if(!$item instanceof HasLookupItems) throw new WireException($this->className() . "::save() requires an item that implements HasLookupItems interface");
if(!$item instanceof HasLookupItems) {
$class = $this->className();
throw new WireException("$class::save() requires an item that implements HasLookupItems interface");
}
$database = $this->wire('database');
$lookupTable = $database->escapeTable($this->getLookupTable());