Skip to content

Commit

Permalink
Merge pull request #15 from ifacesoft/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
dp-ifacesoft committed Apr 3, 2015
2 parents c24da95 + 5f1718b commit cbc4c2b
Show file tree
Hide file tree
Showing 7 changed files with 12,450 additions and 2,938 deletions.
10 changes: 5 additions & 5 deletions Source/Ice/Core/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down
16 changes: 8 additions & 8 deletions Source/Ice/Core/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
15,172 changes: 12,316 additions & 2,856 deletions Var/vendor/phpunit/coverage.xml

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions app.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
* @since 0.0
*/

if (!defined('VENDOR_DIR')) {
define('VENDOR_DIR', dirname(__DIR__) . '/_vendor/');
}

require_once __DIR__ . '/bootstrap.php';

\Ice\App::run();
6 changes: 5 additions & 1 deletion bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@

if (!defined('MODULE_DIR')) {
$moduleDir = php_sapi_name() == 'cli'
? getcwd()
? dirname(realpath($argv[0]))
: dirname(dirname($_SERVER['SCRIPT_FILENAME']));

define('MODULE_DIR', $moduleDir . '/');
}

if (!defined('VENDOR_DIR')) {
define('VENDOR_DIR', dirname(MODULE_DIR) . '/_vendor/');
}

if (!defined('ICE_DIR')) {
define('ICE_DIR', __DIR__ . '/');
}
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
],
"config": {
"vendor-dir": "../_vendor/Ice"
"vendor-dir": "../_vendor"
},
"autoload": {
"psr-4": {"Ice\\": "Source/Ice/"},
Expand All @@ -23,7 +23,8 @@
"require": {
"php": ">=5.4.0",
"twig/twig": "1.*",
"smarty/smarty": "3.1.*"
"smarty/smarty": "3.1.*",
"michelf/php-markdown": "1.5.0"
},
"require-dev": {
"firephp/firephp-core": "dev-master",
Expand Down
Loading

0 comments on commit cbc4c2b

Please sign in to comment.