class CategoryForm extends Form implements ObjectManagerAwareInterface
private $objectManager;
public function __construct(ObjectManager $objectManager)
{
$this->setObjectManager($objectManager);
}
$this->add([
'type' => ObjectSelect::class,
'name' => 'parent',
'attributes' => [
'id' => 'parent',
'class' => 'select'
],
'options' => [
'label' => 'Категория',
'object_manager' => $this->getObjectManager(),
'target_class' => Category::class,
'property' => 'name',
'empty_option' => '== Категория ==',
'is_method' => true,
'find_method' => [
'name' => 'findParentCategories',
'params' => [
//'criteria' => ['status' => 1],
'orderBy' => ['name' => 'ASC'],
],
],
],
]);