zend-framework

Cannot unserialize object after storing it serialized in database

霸气de小男生 提交于 2020-01-12 09:46:49
问题 I'm trying to store a complex object here and am doing that by serialising the object running a mysql_real_escape_string on it and inserting it into a mysql database. However when I retrieve it running a sql query - I'm using Zend frameworks Zend_DB_Table here but anyway - and when I try to stripslashes and unserialize I dont get my object back. I've tried to just unserialize without stripping slashes and all but nothings working. UPDATE This is weird. I made a simple page which just

Cannot unserialize object after storing it serialized in database

瘦欲@ 提交于 2020-01-12 09:46:12
问题 I'm trying to store a complex object here and am doing that by serialising the object running a mysql_real_escape_string on it and inserting it into a mysql database. However when I retrieve it running a sql query - I'm using Zend frameworks Zend_DB_Table here but anyway - and when I try to stripslashes and unserialize I dont get my object back. I've tried to just unserialize without stripping slashes and all but nothings working. UPDATE This is weird. I made a simple page which just

Translating a query to use Zend_Db_Select

怎甘沉沦 提交于 2020-01-12 03:49:05
问题 I'm having some problems translating this query to use ZF's Zend_Db_Select : SELECT b.id, b.title, b.description FROM memberships AS m JOIN blogs AS b ON b.id = m.blog_id WHERE m.user_id = ? ORDER BY m.created LIMIT 0, 30 (this query works and returns results) Memberships is a link table between blogs and users . It's a simple | id | blog_id | user_id | affair. Here's what I have so far: // $table = Zend_Db_Table instance, $id = a user id $select = $table->select() ->from(array('m' =>

MVC: how to ajax?

喜你入骨 提交于 2020-01-11 19:42:09
问题 I'm going to start a project using a Zend Framework MVC implementation. How do I work with ajax? I mean, should I place all ajax code into controller? Or into view? For example, I want to get posts from author 'ivan' to show on a page. Normally, I create a link to '/posts/author/ivan' or smth like it, create a new Action like 'byAuthorAction()' in the Posts controller (or maybe Users controller, wherever), view for it (and all code what gets posts from model goes there) and create a new Route

The supplied parameters to Zend_Auth_Adapter_DbTable failed to produce a valid sql statement

你离开我真会死。 提交于 2020-01-11 11:53:10
问题 I have the following exception Caught exception: The supplied parameters to Zend_Auth_Adapter_DbTable failed to produce a valid sql statement, please check table and column names for validity. I have googled and checked my code over and over again but I have not found a solution. The table and column names are all correct. The section of code that is causing this problem is $result = $auth->authenticate($authAdapter); . Infact the whole controller code is found below: class

The supplied parameters to Zend_Auth_Adapter_DbTable failed to produce a valid sql statement

我只是一个虾纸丫 提交于 2020-01-11 11:52:33
问题 I have the following exception Caught exception: The supplied parameters to Zend_Auth_Adapter_DbTable failed to produce a valid sql statement, please check table and column names for validity. I have googled and checked my code over and over again but I have not found a solution. The table and column names are all correct. The section of code that is causing this problem is $result = $auth->authenticate($authAdapter); . Infact the whole controller code is found below: class

Zend Framework 2 Library Paths

假如想象 提交于 2020-01-11 09:47:06
问题 Trying to get my feet wet on ZF2 and I've stumbled on my first problem. Say on a module I want to use Shanty_Mongo (an external library to connect to MongoDb) So I've copied the entire Shanty directory on the library and created a new Model class: namespace Dummy\Model; use Shanty\Mongo\Document; class Dummy extends Shanty_Mongo_Document { public function setConnections( $connections ) { Shanty_Mongo::addConnections($connections); } } (The setConnections() is to be used by DI, if I've

Why this code is not working on linux server?

会有一股神秘感。 提交于 2020-01-11 06:18:47
问题 I am new to the Zend Framework, and this code is used for downloading contents. This code is working on localhost but when I try to execute it on a linux server it shows error file not found. public function downloadAnnouncementsAction() { $file= $this->_getParam('file'); $file = str_replace("%2F","/",$this->_getParam('file')); // Allow direct file download (hotlinking)? // Empty - allow hotlinking // If set to nonempty value (Example: example.com) will only allow downloads when referrer

phpunit throws Uncaught exception 'PHPUnit_Framework_Exception

谁都会走 提交于 2020-01-11 05:14:08
问题 I have a Zend Framework project, and want to using unit testing to test it. In tests folder, I have the phpunit.xml as following; <phpunit bootstrap="./application/bootstrap.php" colors="true"> <testsuite name="Application Test Suite"> <directory>./</directory> </testsuite> <filter> <whitelist> <directory suffix=".php">../application/</directory> <exclude> <directory suffix=".phtml">../application/</directory> <file>../application/Bootstrap.php</file> <file>../application/controllers

PHP Zend Framework - How to Get Request URI Fragment from Request Object?

青春壹個敷衍的年華 提交于 2020-01-11 02:10:43
问题 Say e.g. i have a URI http://127.0.0.1/somecontroller/someaction#12345 that takes me to the someAction() action of the someController controller. From there, i am able to retrieve the Request object via $this->getRequest() . i am also able to retrieve various information regarding the URI from the Request object. But, how can i retrieve the fragment (i.e. the "12345" part after the # in the e.g.)? Neither getRequestUri() nor getParams() turn up the fragment part. Thanks! 回答1: The fragment