Last active
August 29, 2015 14:11
-
-
Save lfglopes/06725dd1d287d17e7a4e to your computer and use it in GitHub Desktop.
php-activerecord #476
This file contains hidden or 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
From af46512dd5aed90cc9b976f9529a8378cf1707ec Mon Sep 17 00:00:00 2001 | |
From: =?UTF-8?q?Lu=C3=ADs=20Lopes?= | |
Date: Thu, 18 Dec 2014 14:57:23 +0000 | |
Subject: [PATCH] fixed AR serialization problem | |
https://github.com/jpfuentes2/php-activerecord/issues/476 | |
--- | |
kernel/vendor/activerecord/lib/Serialization.php | 5 ++++- | |
1 file changed, 4 insertions(+), 1 deletion(-) | |
diff --git a/kernel/vendor/activerecord/lib/Serialization.php b/kernel/vendor/activerecord/lib/Serialization.php | |
index db02088..523ae54 100755 | |
--- a/kernel/vendor/activerecord/lib/Serialization.php | |
+++ b/kernel/vendor/activerecord/lib/Serialization.php | |
@@ -173,7 +173,10 @@ abstract class Serialization | |
try { | |
$assoc = $this->model->$association; | |
- if (!is_array($assoc)) | |
+ if (is_null($assoc)) { | |
+ $this->attributes[$association] = null; | |
+ } | |
+ elseif (!is_array($assoc)) | |
{ | |
$serialized = new $serializer_class($assoc, $options); | |
$this->attributes[$association] = $serialized->to_a();; | |
-- | |
2.1.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment