[Flow] strange behaviour w. select/multiple and spl_object_hash
Tomas M
flow at 46dev.de
Thu May 7 08:48:22 CEST 2015
Good morning!
Here is my Fluid snippet for selectBox:
<f:form.select property="items" id="items" name="items" options="{allItems}" optionLabelField="caption" multiple="multiple" />
In addition more snippets from code:
Class:
class BaseCls {
/**
* @var string
*
* @Flow\Validate(type="Text")
* @Flow\Validate(type="NotEmpty")
* @Flow\Validate(type="StringLength", options={ "minimum"=5, "maximum"=80 })
* @ORM\Column(length=255)
*/
protected $name;
/**
* @var \Doctrine\Common\Collections\Collection<\ToM\proj\Domain\Model\Item>
* @Flow\Validate(type="NotEmpty")
* @ORM\ManyToMany
* @ORM\Column(nullable=true)
*/
protected $items;
...
/**
* @param \Doctrine\Common\Collections\Collection<\ToM\proj\Domain\Model\Item> $items
* @return void
*/
public function setItems( \Doctrine\Common\Collections\Collection $items = NULL ) {
$this->items = $items;
}
/**
* @return \Doctrine\Common\Collections\Collection<\ToM\proj\Domain\Model\Item>
*/
public function getItems() {
return $this->items;
}
...
controller:
/**
* @Flow\Inject
* @var \ToM\proj\Domain\Repository\ItemRepository
*/
protected $itemRepository;
..
/**
* @return void
*/
public function newAction() {
$this->view->assign( 'allItems', $this->itemRepository->findAll() );
}
/**
* @param \ToM\proj\Domain\Model\Item $item
*
* @return void
*/
public function createAction( \ToM\proj\Domain\Model\Item $item ) {
$this->itemRepository->add( $item );
$this->addFlashMessage( 'Item saved' );
$this->redirect('index');
}
..
More information about the Flow
mailing list