[TYPO3-mvc] How to check if object was created ?
Franz Koch
typo3.RemoveForMessage at elements-net.de
Tue Mar 8 10:54:27 CET 2011
Hey,
> $temp = t3lib_div::makeInstance("Tx_MyExt_Domain_Model_Record");
> $temp = $this->findByExtRec($resVal['uid']);
>
> How can I check is $temp is really an object?
why do you first create a empty object and then overwrite it by a method
call again? And as of Extbase 1.3 it's recommended to use the
$this->objectManager->get('Tx_Ext_Domain_Model_Foo') instead of
t3lib_div::makeInstance.
> Not always I`ll find an object in database so I need to check before
> I`ll use for example $temp->getUid()
>
> How can I do that ?
just have a look at the php documentation or google ;P
if ($temp !== NULL && is_object($temp)) {
// do something
}
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list