Jump to content

Featured Replies

Posted

Hello

I'm not sure what's the correct room to post this

I'm forwarding this from one of my staff who tries to create a custom app:

is it a bug or is he missing something?


There seems to be problem with loading classes with same IDs.

The Models has same namespace.

class ClassOne extends Item
{ ... }


class ClassTwo extends ActiveRecord
{ ... }


When loading classes with same ID in controller:

$variable1 = ClassOne::load(1);
$variable2 = ClassTwo::load(1);
The result is that both variables will be the same ClassOne -object.


When switched around:
$variable2 = ClassTwo::load(1);
$variable1 = ClassOne::load(1);
The result is that both variables will be the same ClassTwo-object.

 

If the IDs are not the same, both classes loads correctly. 
$variable2 = ClassTwo::load(1);
$variable1 = ClassOne::load(2);

Solved by Daniel F

Go to solution
  • Community Expert
  • Solution

Ask him if he has declared the $multitons variable in the classes;)

	/**
	 * @brief	Multiton Store
	 */
	protected static $multitons;
  • Author

Thank you @Daniel F that was the problem

Recently Browsing 0

  • No registered users viewing this page.