The previous question about a Doctrine error was solved, but here's a
new one for anyone interested - back to variable entity/class names.
This time I'm trying to get a new Entity class using a variable and
then call its setter methods with a variable as well, sort of like the
example below.

The reason it needs to work this way is to import data from various
CSV files with a variable numbers of fields in each one. This method
works perfectly with plain PHP, but it doesn't seem to work in
Symfony: I get a "Call to undefined function agency()" error when I
run this code within a Symfony controller (yes, the relevant Entity
has been imported with use;)

//the entity
class Agency
{
        public $hello;

        public function setHello ($hello) {
                $this->hello = $hello;
        }
}

//the controller
class ExampleController extends Controller
{
        $var = 'Agency';
        $Entity = new $var();

        $setter = 'setHello';
        $Entity->$fn('world');
}

Again, any help would be vastly appreciated!

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to symfony-devs@googlegroups.com
To unsubscribe from this group, send email to
symfony-devs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to