English 中文(简体)
理论 2.0 - 观察信息时与阵列而不是物体相联
原标题:Doctrine 2.0 - Hydrating to array rather than object when viewing information

我有两个问题,一时我就一直在讨论。 我正在使用Doctrine 2.0来开展一些我正在从事的项目,我已经触及了一个大问题。

In most of the projects frontend applications I am hydrating to arrays rather than objects; by which I mean when I produce a doctrine query I might do this:

$entityManager = $this->getEntityManager();
$query = $entityManager->getQueryBuilder();
$query->select( something ,  somethingElse )
      ->from( MyEntityLocation ,  something )
      ->leftJoin( something.somethingelse ,  somethingElse )
      ->where( something.id = :someId )
      ->setParameter( someId , $someId)
      ->getQuery();

$result = $query->getArrayResult();

现在,这是我对我们申请前端的所有法典所做的事,因为对阵列的hydr力远比对物体的hydr。 现在我的问题是: 如果我使用斜线,我是否应该真正使用<条码>植被恢复(<>条码/代码”),然后通过实体回到那里来,与他们交流?

I use getResult or getSingleResult when I am say in the administration area and I am making a change to an entity; however it just feels a little odd using the incredibly heavy Doctrine just to retrieve information into an array on the frontend - something I could do with a simple PDO anyway?!?

我希望我提出的问题足够清楚。

纽约总部

最佳回答

理论会增加验证,使合并成为文字的便利。 这种便利可能不是免费的,但在考虑长期维护时可能仍然有利。 如果你担心业绩,我会建议你做一些分析,以了解其实际费用。 如果在Doctrine所有割裂都能得到治疗,则不会比直接询问昂贵得多。

如果你真的需要额外业绩的提高,那么直接接触到安理会是不会错的,但我会建议,在你有证据证明问题确实在于通过貌相来。

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签