Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: kohana/orm
...
head fork: kohana/orm
Checking mergeability… Don't worry, you can still create the pull request.
  • 6 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
17 classes/kohana/auth/orm.php
@@ -174,19 +174,20 @@ public function auto_login()
/**
* Gets the currently logged in user from the session (with auto_login check).
- * Returns FALSE if no user is currently logged in.
+ * Returns $default if no user is currently logged in.
*
- * @param mixed $default
+ * @param mixed $default to return in case user isn't logged in
* @return mixed
*/
public function get_user($default = NULL)
{
$user = parent::get_user($default);
- if ( ! $user)
+ if ($user === $default)
{
// check for "remembered" login
- $user = $this->auto_login();
+ if (($user = $this->auto_login()) === FALSE)
+ return $default;
}
return $user;
@@ -214,7 +215,13 @@ public function logout($destroy = FALSE, $logout_all = FALSE)
if ($token->loaded() AND $logout_all)
{
- ORM::factory('user_token')->where('user_id', '=', $token->user_id)->delete_all();
+ // Delete all user tokens. This isn't the most elegant solution but does the job
+ $tokens = ORM::factory('user_token')->where('user_id','=',$token->user_id)->find_all();
+
+ foreach ($tokens as $_token)
+ {
+ $_token->delete();
+ }
}
elseif ($token->loaded())
{
View
7 classes/kohana/orm.php
@@ -49,7 +49,6 @@
* @property bool $loaded ORM object was loaded?
* @property bool $saved ORM object was saved?
* @property mixed $primary_key
- * @property mixed $primary_val
* @property string $table_name
* @property string $table_columns
* @property array $has_one
@@ -87,7 +86,7 @@ class Kohana_ORM extends Model implements serializable {
protected static $_properties = array
(
'object_name', 'object_plural', 'loaded', 'saved', // Object
- 'primary_key', 'primary_val', 'table_name', 'table_columns', // Table
+ 'primary_key', 'table_name', 'table_columns', // Table
'has_one', 'belongs_to', 'has_many', 'has_many_through', 'load_with', // Relationships
'updated_column', 'created_column',
'validation',
@@ -533,7 +532,7 @@ public function __toString()
* Allows serialization of only the object data and state, to prevent
* "stale" objects being unserialized, which also requires less memory.
*
- * @return array
+ * @return string
*/
public function serialize()
{
@@ -1402,7 +1401,7 @@ public function save(Validation $validation = NULL)
}
/**
- * Deletes a single record or multiple records, ignoring relationships.
+ * Deletes a single record while ignoring relationships.
*
* @chainable
* @return ORM
View
5 classes/model/auth/user/token.php
@@ -11,6 +11,11 @@ class Model_Auth_User_Token extends ORM {
// Relationships
protected $_belongs_to = array('user' => array());
+
+ protected $_created_column = array(
+ 'column' => 'created',
+ 'format' => TRUE,
+ );
/**
* Handles garbage collection and deleting of expired objects.

No commit comments for this range

Something went wrong with that request. Please try again.