-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from ifacesoft/master
Master
- Loading branch information
Showing
7 changed files
with
12,450 additions
and
2,938 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -815,22 +815,21 @@ public static function getData(array $filterFields = []) | |
/** | ||
* Return model by custom field | ||
* | ||
* @param $fieldName | ||
* @param $fieldValue | ||
* @param array $fieldValueNames | ||
* @param $fieldNames | ||
* @param string|null $dataSourceKey | ||
* @param int $ttl | ||
* @return Model|null | ||
* | ||
* @author dp <[email protected]> | ||
* | ||
* @version 0.4 | ||
* @version 0.6 | ||
* @since 0.0 | ||
*/ | ||
public static function getModelBy($fieldName, $fieldValue, $fieldNames, $dataSourceKey = null, $ttl = null) | ||
public static function getModelBy(array $fieldValueNames, $fieldNames, $dataSourceKey = null, $ttl = null) | ||
{ | ||
return Query::getBuilder(self::getClass()) | ||
->eq([$fieldName => $fieldValue]) | ||
->eq($fieldValueNames) | ||
->limit(1) | ||
->select($fieldNames, [], $dataSourceKey) | ||
->getModel($ttl); | ||
|
@@ -1069,6 +1068,7 @@ private function insert($modelClass, $affected, $isSmart, $dataSourceKey) | |
|
||
$insertId = Query::getBuilder($modelClass) | ||
->insert($affected, $isSmart, $dataSourceKey) | ||
->execute() | ||
->getInsertId(); | ||
|
||
$this->set(reset($insertId)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1086,11 +1086,11 @@ public function left($modelTableData, $fieldNames = '/pk', $condition = null) | |
* @param bool $update | ||
* @param string|null $dataSourceKey | ||
* @param int $ttl | ||
* @return Query_Result | ||
* @return Query | ||
* | ||
* @author dp <[email protected]> | ||
* | ||
* @version 0.2 | ||
* @version 0.6 | ||
* @since 0.0 | ||
*/ | ||
public function insert(array $data, $update = false, $dataSourceKey = null, $ttl = null) | ||
|
@@ -1107,11 +1107,11 @@ public function insert(array $data, $update = false, $dataSourceKey = null, $ttl | |
* @param $part | ||
* @param $dataSourceKey | ||
* @param $ttl | ||
* @return Query_Builder | ||
* @return Query | ||
* | ||
* @author dp <[email protected]> | ||
* | ||
* @version 0.2 | ||
* @version 0.6 | ||
* @since 0.1 | ||
*/ | ||
private function affect(array $data, $part, $dataSourceKey, $ttl) | ||
|
@@ -1163,11 +1163,11 @@ private function affect(array $data, $part, $dataSourceKey, $ttl) | |
* @param array $data Key-value array | ||
* @param null $dataSource | ||
* @param int $ttl | ||
* @return Query_Result | ||
* @return Query | ||
* | ||
* @author dp <[email protected]> | ||
* | ||
* @version 0.2 | ||
* @version 0.6 | ||
* @since 0.0 | ||
*/ | ||
public function update(array $data, $dataSource = null, $ttl = null) | ||
|
@@ -1182,11 +1182,11 @@ public function update(array $data, $dataSource = null, $ttl = null) | |
* @param array $pkValues | ||
* @param string|null $dataSourceKey | ||
* @param int $ttl | ||
* @return Query_Result | ||
* @return Query | ||
* | ||
* @author dp <[email protected]> | ||
* | ||
* @version 0.2 | ||
* @version 0.6 | ||
* @since 0.0 | ||
*/ | ||
public function delete($pkValues = [], $dataSourceKey = null, $ttl = null) | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.