Offcourse!

Here's the URL: http://pastie.org/1330361

kind regards
Bram Gadeyne

On 28-11-10 19:30, Hector Virgen wrote:

Can you use pastebin.com <http://pastebin.com> or pastie.org <http://pastie.org> instead? Thanks!

--
Hector Virgen
Sent from my Droid X

On Nov 28, 2010 10:01 AM, "Bram Gadeyne" <[email protected] <mailto:[email protected]>> wrote:
> Thank you for your answer!
>
> However, I think I already do what you propose here. Here's the first
> method from my bootstrap file.:
>
> protected function _initAutoload(){
> $modelLoader=new Zend_Application_Module_Autoloader(array(
> 'namespace' => '',
> 'basePath' => APPLICATION_PATH.'/modules/default'));
>
> if(Zend_Auth::getInstance()->hasIdentity()){
>
> Zend_Registry::set('role',Zend_Auth::getInstance()->getStorage()->read()->role);
> }else{
> Zend_Registry::set('role','guests');
> }
>
> class_exists('Shop_Model_Card', true); //this returns false
> Zend_Session::start();
>
> $this->_acl=new Model_UitleendienstACL();
>
> $fc=Zend_Controller_Front::getInstance();
>
> $fc->addModuleDirectory(dirname(dirname(__FILE__)).'/application/modules');
> $fc->registerPlugin(new Plugin_AccessCheck($this->_acl));
>
> return $modelLoader;
> }
>
> I've added my complete bootstrap file as an attachment.
>
> With kind regards
> Bram Gadeyne
>
> On 28-11-10 18:46, Hector Virgen wrote:
>>
>> Is the module autoloader set up before the session is started? If you
>> are using protected _init* methods in your bootstrap, make sure the
>> autoloader method is above the session one, or call
>> $this->bootstrap('autoloader') within your _initSession method.
>>
>> --
>> Hector Virgen
>> Sent from my Droid X
>>
>> On Nov 28, 2010 7:43 AM, "Bram Gadeyne" <[email protected] <mailto:[email protected]>
>> <mailto:[email protected] <mailto:[email protected]>>> wrote:
>> > Dear all,
>> >
>> > I'm trying to persist some objects to the session. But everything I try
>> > end up with the following error message:
>> >
>> > Fatal error: Shop_CardController::addAction(): The script tried to
>> > execute a method or access a property of an incomplete object. Please
>> > ensure that the class definition "Default_Model_Card" of the object you >> > are trying to operate on was loaded _before_ unserialize() gets called
>> > or provide a __autoload() function to load the class definition in
>> >
>> /var/www/uitleendienst/application/modules/shop/controllers/CardController.php
>>
>> > on line 43
>> >
>> > These are my settings in the bootstrap.php for autoloading modules:
>> >
>> > $modelLoader=new Zend_Application_Module_Autoloader(array(
>> > 'namespace' => '',
>> > 'basePath' => APPLICATION_PATH.'/modules/default'));
>> >
>> > In the bootstrap I've also entered:
>> > class_exists('Shop_Model_Card', true); //returns false
>> > Zend_Session::start();
>> >
>> > This is the code that results in an error:
>> >
>> > 37 $ns = new Zend_Session_Namespace('mysession');
>> > 38 if(!isset($ns->card)){
>> > 39 $card=new Shop_Model_Card();
>> > 40 }else{
>> > 41 $card=$ns->card;
>> > 42 }
>> > 43 $card->addUitleningToList("value");
>> > 44 $ns->card = $card;
>> >
>> > The code returns this error when the else part is executed and
>> $ns->card
>> > should get deserialized. How do I get Zend framework to autoload the
>> > Shop_Model_Card class?
>> >
>> > This is my class definition for Shop_Model_Card.
>> >
>> > class Shop_Model_Card{
>> >
>> > private $uitleningen;
>> >
>> > public function getUitleningen(){
>> > return $this->uitleningen;
>> > }
>> >
>> > public function __construct() {
>> > //$this->uitleningen=array();
>> > }
>> >
>> > public function clear(){
>> > $this->uitleningen=array();
>> > }
>> >
>> > public function addUitleningToList($uitlening){
>> > if($this->uitleningen==null){
>> > $this->uitleningen=array();
>> > }
>> > array_push($this->uitleningen, $uitlening);
>> > }
>> >
>> > public function removeFromList($uitleningid){
>> > $temparr=array();
>> > $i=$uitleningid;
>> > while($i<sizeof($this->uitleningen-1)){
>> > $this->uitleningen[$i]=$this->uitleningen[$i+1];
>> > $i++;
>> > }
>> > $this->uitleningen[$i+1]=null;
>> > }
>> > }
>> >
>> > Can someone help me please?
>> >
>> > With kind regards,
>> > Bram Gadeyne

Reply via email to