orm - PHP CodeIgniter returning Controller Name rather than Doctrine Associated Entity


I have a basic entity that has aUnidirectional OneToOne relationship with another entity. I have an instance of the owning entity that's created via a variable method as so:

$entity = new $entity;

where$entity on the right-hand side is simply a string that describes the class. When I grab the inverse entity (anAddress) from the owning entity it returns a class of the same type as the controller I'm using.

$object = $entity->getAddress();

this line of code returns an object of typeAjax (the controller this code is in in CodeIgniter). The code for the getter is simple, nothing fancy:

public function getAddress() {
    return $this->address;

What could possibly be going on here? Why would I be getting back an instance of my controller?




What is $this->address set as?

Is it possibly that you setting$this->address = $this?

Because if$this->address = $this then

$object = $entity->getAddress();

is really

$object = $entity;

which of course is an object of type $entity;

People are also looking for solutions to the problem: php - jquery to construct a string and pass it as a post argument for file


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.