Hello,

I have a Form for a Product and since Product is one of the central 
Entities in my application there are various related Entities.
One of them is Label and can contain so many rows that an ObjectSelect is 
not appropriate.
Therefore I would like to implement something more or less similar but with 
Search functionality.
I would like to search for the name of the Label and have the Id added.

My ObjectSelect works fine and looks like this:

class ProductForm extends Form implements ObjectManagerAwareInterface
{

    protected $objectManager;

    public function __construct(ObjectManager $objectManager)
    {

        $this->setObjectManager($objectManager);

        parent::__construct('ProductAttributes');
        $this->setHydrator(new 
DoctrineEntity($this->getObjectManager()))->setObject(new Product());

        $this->addElements();
    }

    public function addElements()
    {
// Add various elements

        $this->add(array(
            'name' => 'label',
            'type' => 'DoctrineModule\Form\Element\ObjectSelect',
            'options' => array(
                'object_manager' => $this->getObjectManager(),
                'target_class' => '\Entities\Label',
                'property' => 'name',
                'is_method' => true,
                'find_method' => array(
                    'name' => 'findAll',
                ),
            ),
        ));
        

        $this->add(array(
            'name' => 'submit',
            'type' => 'Submit',
            'attributes' => array(
                'value' => 'Go',
                'id' => 'submitbutton',
            ),
        ));
    }

    public function setObjectManager(ObjectManager $objectManager)
    {
        $this->objectManager = $objectManager;
    }

    public function getObjectManager()
    {
        return $this->objectManager;
    }

}

Is there an easy way to implement similar functionality but with a search 
feature?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to