Nette 2.2.2 bootstrap a dateinput (Vodacek)
Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
- Muhahe
- Člen | 79
Zdravim,
zkousim prechod na novou verzi nette 2.2.2 a nedari se mi rozchodit dateinput z addonu. V bootstrapu mam tento addon zaregistrovany
<?php
require __DIR__ . '/../vendor/autoload.php';
$configurator = new Nette\Configurator;
//$configurator->setDebugMode(TRUE); // debug mode MUST NOT be enabled on production server
$configurator->enableDebugger(__DIR__ . '/../log');
$configurator->setTempDirectory(__DIR__ . '/../temp');
$configurator->createRobotLoader()
->addDirectory(__DIR__)
->addDirectory(__DIR__ . '/../vendor/others')
->register();
$configurator->addConfig(__DIR__ . '/config/config.neon');
$configurator->addConfig(__DIR__ . '/config/config.local.neon');
Vodacek\Forms\Controls\DateInput::register($configurator);
$container = $configurator->createContainer();
return $container;
v samotnem formulari ho pouzivam takto
protected function createComponentNewProjectForm() {
$assign = $this->makePairs($this->usersRepository->findAllNoViewUsers());
$view = $this->makePairs($this->usersRepository->findAllViewOnlyUsers());
$form = new Form;
$form->addText('projectId', 'Project ID', 40, 100)
->addRule(Form::FILLED, "Project ID must be filled.");
$form->addText('customer', 'Customer', 40, 100);
$form->addText('platform', 'Platform', 40, 100);
$form->addText('product', 'Product', 40, 100);
$form->addText('link', 'Link', 40, 100);
$form->addText('priority', 'Priority', 2, 2)
->setType('number')
->addRule(Form::RANGE, 'Priority must be from %d to %d', array(0, 99));
$form->addSelect('assign', 'Assign', $assign)
->setPrompt('none');
$form->addSelect('view', 'Viewer', $view)
->setPrompt('none');
$start = $form->addDate('start', 'Start', Vodacek\Forms\Controls\DateInput::TYPE_DATE);
$form->addDate('end', 'End', Vodacek\Forms\Controls\DateInput::TYPE_DATE);
//->addRule($validDate, 'Start date must be before end date.', $start);
$form->addTextArea('description', 'Description', 60, 20);
$form->addHidden('leader')
->setDefaultValue($this->user->id);
$form->onSuccess[] = callback($this, 'createNewProjectSubmitForm');
$form->elementPrototype->addAttributes(array('class' => 'ajax'));
$form->setDefaults(array(
'priority' => '0',
'start' => new DateTime(),
'end' => new DateTime()
));
return $form;
}
ale nette hazi chybu
Class ‚Vodacek\Forms\Controls\DateInput‘ not found
nad radkem s registraci v bootstrapu.
Zkousel jsem prochazet forum a i stranku s addonem, ale nenasel jsem nejake reseni. Nesetkal se nekdo s timto problemem?