Yii Framework Forum: [Solved] Problem With Autoloader - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Solved] Problem With Autoloader Rate Topic: -----

#1 User is offline   jneto 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 49
  • Joined: 19-November 12
  • Location:Portugal

Posted 05 March 2013 - 10:24 PM

Hello, i'm trying to connect my Yii application using REST, to other application that already have autoloader .
Both applications run in the same machine.
The problem is that after the REST call, Yii try to autoload the classes of the other application.

Can you help me ?

Thanks.
0

#2 User is offline   Giuseppe Santoro 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 15-October 12

Posted 06 March 2013 - 04:04 AM

Hi jneto,
I think you should disable Yii autoloader with
spl_autoload_unregister(array('YiiBase','autoload'));

and after then you loaded the external code, you should reenable the autoloader with
spl_autoload_register(array('YiiBase','autoload'));


This article explain this mechanism.

What REST system are you using?
0

#3 User is offline   jneto 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 49
  • Joined: 19-November 12
  • Location:Portugal

Posted 06 March 2013 - 09:19 AM

Thanks.

I was using
spl_autoload_unregister(array('YiiBase','autoload'));


but i found that the problem was in the result of the REST call. The result is an array with some objects inside.
The objects belong the the other application and Yii was trying to load the objects classes. I change the results only to arrays and now it works.


The other application is an internal application created with PHP without any framework. It have some webservices (SOAP and REST ) and i use CURL on Yii the make the REST calls.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users