public function setClassName($className) { $this->className = $className; if ($this->object === NULL) { $this->object = new $className(); } $this->classSchema = Expose::classSchemaFactory()->createClassSchema($className); $accessor = PropertyAccess::createPropertyAccessor(); foreach ($this->classSchema->getProperties() as $property) { if (!$accessor->isReadable($this->object, $property->getName())) { // todo, what happened here? // handle not settable properties continue; } if ($property->isHidden()) { $formField = $this->createHiddenField($property->getName()); $formField->setDefault($accessor->getValue($this->object, $property->getName())); } else { $formField = $this->createField($property->getName()); $formField->setControl($property->getControl()); $formField->setDefault($accessor->getValue($this->object, $property->getName())); $formField->setRequired($property->getRequired()); $formField->setValidator(new SymfonyValidator($property->getAnnotations())); } } }
public function setClassName($className) { $this->className = $className; $this->classSchema = Expose::classSchemaFactory()->createClassSchema($className); // $this->repository = $this->container->get('doctrine')->getManager()->getRepository($className); }