For Cake3, look at these manual entries:
http://book.cakephp.org/3.0/en/orm/saving-data.html#saving-complex-types
http://book.cakephp.org/3.0/en/orm/database-basics.html#adding-custom-database-types
For Cake2 you could use SerializableBehaviour from CakeDC/Utils plugin:
https://github.com/CakeDC/utils
El domingo, 10 de mayo de 2015, 4:16:54 (UTC+1), Ryan de Haast escribió:
-- http://book.cakephp.org/3.0/en/orm/saving-data.html#saving-complex-types
http://book.cakephp.org/3.0/en/orm/database-basics.html#adding-custom-database-types
For Cake2 you could use SerializableBehaviour from CakeDC/Utils plugin:
https://github.com/CakeDC/utils
El domingo, 10 de mayo de 2015, 4:16:54 (UTC+1), Ryan de Haast escribió:
Hi All
Can anybody explain to me how to get the data from column type that is a blob. when I retrieve the data from the database I'm able to get the details for all the columns however when a column is a blob it returns a resource. When I do a vardump on the data that's returned it shows it as resource stream
Here's some of my code, the part where I'm trying to get the contents:
foreach($list as $anArt)
{
pd($anArt);
print_r($anArt->article_serialized );
var_dump($anArt->article_serialized );
$contents = fread($anArt->article_serialized , 1000000);
pd($contents);
$data = "";
while (!feof($anArt->article_serialized )) {
$data .= stream_get_line($anArt->article_serialized , 1000000);
}
pd($data);
}
The pd function is debug function used in the above code is just to print out the data as I'm working through it. The data in the specific column is stored as a serialized string
Please advise...
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment