[TYPO3-mvc] edit and update Actions + hidden objects

Daniel Dimitrov danielsd_bg at yahoo.fr
Wed Sep 1 12:34:34 CEST 2010


Hey Guys,
I've read a lot of threads here in the list about this, but I don't seem to 
find an appropriate solution.

When a record has the hidden field set to 1, then all kind of problems arise 
when I try to do something with it.

For example:

public function editAction(Tx_BwShop_Domain_Model_Product $product) {
...
}

whenever I try to access the editAction with an object that has a hidden=1 
then extbase throws an exceptions like this:

Tx_Extbase_MVC_Exception_InvalidArgumentValue

The value must be of type "Tx_BwShop_Domain_Model_Product", but was of type 
"NULL".

Ok, I can go around this exception by changing my editAction to
public function editAction (int $product) {
$product = $this->productRepository->getByUid($product, FALSE);
}

my getByUid method looks like this:
public function findByUid($uid, $respectableFields = true) {
	$query = $this->createQuery();
	$query->getQuerySettings()->setRespectEnableFields($respectableFields);
	return $query->matching(
		$query->equals('uid', $uid)
		)
		->execute();
    }

This works fine and I would accept this as a solution, but this could not 
work with my update method:
public function updateProductAction(Tx_BwShop_Domain_Model_Product $product) 
{
.....
}

here again I get the same exception as above. But fetching the object from 
the database is not an option.
Should I build the product object myself with
$product = makeInstance::....
$product->setMethod($_POST['description'])....

This definitely would destroy the fun with extbase. Please tell me that 
there is a typoscript setting that I can
set or whatever and extbase will magically start to have fun with hidden 
objects, please :)

Cheers,
Daniel 



More information about the TYPO3-project-typo3v4mvc mailing list