[TYPO3-50-general] better "lazy debugging" in FLOW3?
Thomas Allmer
at at delusionworld.com
Tue May 19 20:23:52 CEST 2009
hey
I'm just curious or I'm the only one having problems with "lazy
debugging" (lazy in form of I don't want to use much effort [like a full
debugger])
basically I want to use FirePHP to just output an object for Example
BlogController.php -> IndexAction
$blogs = $this->blogRepository->findAll();
\F3\debug( $blogs );
if I do this, it will just fail as it will try to output something like
this (I just cut it):
Array ( [0] => F3\Blog\Domain\Model\Blog_AOPProxy_Development Object (
[targetMethodsAndGroupedAdvices:protected] => Array (
[FLOW3_Persistence_isNew] => Array ( [F3\FLOW3\AOP\AroundAdvice] =>
Array ( [0] => F3\FLOW3\AOP\AroundAdvice Object (
[aspectObjectName:protected] =>
F3\FLOW3\Persistence\Aspect\DirtyMonitoring [adviceMethodName:protected]
=> isNew [objectManager:protected] => F3\FLOW3\Object\Manager Object (
[context:protected] => Development [reflectionService:protected] =>
F3\FLOW3\Reflection\Service Object ( [initialized:protected] => 1
[cache:protected] => F3\FLOW3\C...
The problem is that the blog object has far more variables than my
domain model as they are needed for persistence and AOP and so on (I guess)
However what I'm interested in is my Domain Model so it's basically
"just" this
Array
(
[0] => F3\Blog\Domain\Model\Blog_AOPProxy_Development Object
(
[name:protected] => FLOW3
[description:protected] => A blog about FLOW3 development.
[logo:protected] =>
[isNew:protected] =>
[isDirty:protected] =>
)
)
so how can I get there? This is my solution! what do you think? it,
makes testing variables just way easier...
1) we need a function that will clear my blog object from all the
internal variables
http://pastie.org/483042
It basically just checks for the "original" Class function and unsets
everything else. (it will also call the __debug() for containing subObjects)
now if I want I could do
\F3\debug( $blogs[0]->__debug() );
and it will show me just the stuff I need
Further improvements:
- create a dedicated debug function that will try to use the __debug
function first before outputting something; as an example included into
FirePHP http://pastie.org/483052
- don't manually create this function, I guess the AOP Proxy would be
the perfect place to include this function into every class.
So I guess the function name __debug() is a little bad; maybe something
like FLOW3_AOP_Proxy_clearInternalVariables()
What do you think of the general idea? or do you have any other solution
on howto debug easy? [without using a full blown debugger... I'm just to
lazy for this type of debugging... :p]
cheers
--
+---------------------------------+-----------------------------------+
| Thomas Allmer | http://www.delusionworld.com |
| E-mail: at at delusionworld.com | phone: +43 699 16217064 |
+---------------------------------+-----------------------------------+
More information about the TYPO3-project-5_0-general
mailing list