php - How to print single value of entity without dumping the whole object? -



php - How to print single value of entity without dumping the whole object? -

i want 1 single value entity.can help me here. here code.please allow me know missing here.

$query = $em->createquery("select e adminbundle:mailtemplates e e.keyword = '" .$keywordval."'"); $query->execute(); $result = $query->getresult(); echo $result ->getid();

here want 'id'.

this noted in documentation how can this.

so given you're code become:

$query = $em->createquery("select e.id adminbundle:mailtemplates e e.keyword = ?1"); $query->setparameter(1, $keywordval); $query->execute(); $result = $query->getresult(); // array of mailtemplates ids

note: made utilize of setparameters instead of setting value straight in query.

php symfony2 doctrine2

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -