I'm a .NET convert to PHP and am so far having a good time with the transition. I'm using doctrine 1.2 as my ORM and have my models working and everything is connected fine. However, the problem i'm looking at now is the output objects are enormous. I have a fairly simple table called USERS -- it has probably 8 columns and FKs to 4 or 5 other tables. I'm using the code below to hydrate my USERS object:
$q = Doctrine_Query::create()
->select('u.*')
->from('USERS u')
->where('u.VANITY_URL = ?',$Url_Frag);
$users = $q->execute();
print_r($users);
I see the object hydrated w/ my data so that's good. However, it also comes along with what looks like a bunch of meta data that I obviously don't need. Overall, the object is over 5000+ lines long! I'm sure there's an obvious switch somewhere that basically says "only emit such-and-such data" but I can't find it in the doctrine manual.
Thoughts?
In Doctrine2, there is a dump()
method available at:
\Doctrine\Common\Util\Debug::dump($var, $maxDepth)
It does a job similar to print_r
and var_dump
, but hides all the Doctrine-related data.
Maybe there is something similar for Doctrine 1.x?
Doctrine 1.2 entities object and collections has a method named "toArray". So you can do:
print_r($users->toArray());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With