Symfony2双翻译问题,怎么解决朝鲜问题双轨并行

Okay so, I'm trying to create a new object of the class "Engineering_Detail" inside my custom action "next", the problem is, even though I'm using "Use ....\Entity\Engineering_Detail" it throws that error on the line i'm doing $detail = new Engineering_Detail();
FatalErrorException: Error: Class 'Mine\Bundle\EngMgmtBundle\Entity\Engineering_Detail' not found in C:\xampp\htdocs\EngMgmt\src\Mine\Bundle\EngMgmtBundle\Controller\EngineeringController.php line 403
The line 403 is $detail = new Engineering_Detail();
Here's the important controller bits:
namespace Mine\Bundle\EngMgmtBundle\C
use Symfony\Component\HttpFoundation\R
use Symfony\Bundle\FrameworkBundle\Controller\C
use Sensio\Bundle\FrameworkExtraBundle\Configuration\M
use Sensio\Bundle\FrameworkExtraBundle\Configuration\R
use Sensio\Bundle\FrameworkExtraBundle\Configuration\T
use Mine\Bundle\EngMgmtBundle\Entity\E
use Mine\Bundle\EngMgmtBundle\Form\EngineeringT
use Mine\Bundle\EngMgmtBundle\Entity\Engineering_D
* Engineering controller.
* @Route("/engineering")
class EngineeringController extends Controller
* Updates a Engineering entity.
* @Route("/{id}/next/", name="engineering_next")
* @Method("POST")
* @Template("MineEngMgmtBundle:Engineering:update.html.twig")
public function nextAction(Request $request, $id){
$em = $this-&getDoctrine()-&getManager();
$entity = $em-&getRepository('MineEngMgmtBundle:Engineering')-&find($id);
$current_form = $this-&getForm($entity-&getStatus()-&getInternalOrder());
$current_form-&handleRequest($request);
$detail = new Engineering_Detail();
if ($current_form-&isValid()) {
$data = $current_form-&getData();
switch ($entity-&getStatus()-&getInternalOrder()){
if (($data["sitesurvey"]) == 'n'){
$status = $em-&getRepository('MineEngMgmtBundle:Status')-&findBy(array('internalOrder' =& 8));
$next_form = $this-&getForm($entity-&getStatus()-&getInternalOrder());
$status = $em-&getRepository('MineEngMgmtBundle:Status')-&find(2);
$next_form = $this-&getForm($entity-&getStatus()-&getInternalOrder());
$status = $em-&getRepository('MineEngMgmtBundle:Status')-&findBy(array('internalOrder' =& $entity-&getStatus()-&getInternalOrder()+1));
$next_form = $this-&getForm($entity-&getStatus()-&getInternalOrder());
$detail-&setEngineering($entity);
$detail-&setFromStatus($entity-&getStatus());
$detail-&setToStatus($status);
$detail-&setUpdatedDate(new \DateTime());
$detail-&setUser($this-&get('security.context')-&getToken()-&getUser());
$detail-&setComments($data["comments"]);
$entity-&setStatus($status);
$em-&flush();
return array(
'entity' =& $entity,
=& $next_form-&createView()
I already checked
and verified but everything seems okay. That entity was generated using the tools inside the SF2 console. What am I doing wrong?
Note: I have already deleted cache
Tried with all other entities, using the same namespace and just changing the entity's name, and declaring objects, it seems the issue it's just with the entities with the _ in their name.
解决方案 Fixed by deleting the _ in the entity name and changing all of its occurrences
本文地址: &
好吧,我试图在我的自定义操作“next”中创建一个类“Engineering_Detail”的新对象,问题是,即使我使用“使用...” .\Entity\Engineering_Detail“它会抛出该错误,我正在做 $ detail = new Engineering_Detail();
FatalErrorException:错误:在C:\xampp\htdocs中找不到类'Mine\Bundle\EngMgmtBundle\Entity\Engineering_Detail' \EngMgmt\src\Mine\Bundle\EngMgmtBundle\Controller\EngineeringController.php行403
该行403是 $ detail = new Engineering_Detail();
这是重要的控制器位:
命名空间Mine\Bundle\EngMgmtBundle\C
使用Symfony\Component\HttpFoundation\R 使用Symfony\Bundle\FrameworkBundle\Controller\C 使用Sensio\Bundle\FrameworkExtraBundle\Configuration\M 使用Sensio\Bundle\FrameworkExtraBundle\Configuration\R 使用Sensio\Bundle\FrameworkExtraBundle\Configuration\T 使用Mine\Bundle\EngMgmtBundle\Entity\E 使用Mine\Bundle\EngMgmtBundle\Form\EngineeringT 使用Mine\Bundle\EngMgmtBundle\Entity\Engineering_D
*工程控制器。
* @Route(“/ engineering”) * /
class EngineeringController扩展Controller
*更新一个工程实体。
* @Route(“/ {id} / next /”,name =“engineering_next”) * @Method(“POST”) * @Template(“ B
public function nextAction(Request $ request,$ id){ $ em = $ this-& getDoctrine() - & getManager();
$ entity = $ em-& getRepository('MineEngMgmtBundle:Engineering') - & find($ id);
$ current_form = $ this-& getForm($ entity-& getStatus() - & getInternalOrder());
$ current_form-& handleRequest($ request);
$ detail = new Engineering_Detail();
if($ current_form-& isValid()){
$ data = $ current_form-& getData();
switch($ entity-& getStatus() - & getInternalOrder()){ 案例1:
if(($ data [“sitesurvey”])=='n'){ $ status = $ em-& getRepository('MineEngMgmtBundle:Status') - & findBy(array('internalOrder'=& 8));
$ next_form = $ this-& getForm($ entity-& getStatus() - & getInternalOrder()); } else { $ status = $ em-& getRepository('MineEngMgmtBundle:Status') - & find(2);
$ next_form = $ this-& getForm($ entity-& getStatus() - & getInternalOrder()); }
默认值: $ status = $ em-& getRepository('MineEngMgmtBundle:Status') - & findBy(array('internalOrder'=& $ entity-& getStatus ) - > getInternalOrder()+ 1));
$ next_form = $ this-& getForm($ entity-& getStatus() - & getInternalOrder());
$ detail-& setEngineering($ entity);
$ detail-& setFromStatus($ entity-& getStatus());
$ detail-& setToStatus($ status);
$ detail-& setUpdatedDate(new \DateTime());
$ detail-& setUser($ this-& get('security.context') - & getToken() - & getUser());
$ detail-& setComments($ data [“comments”]);
$ entity-& setStatus($ status);
$ em-& flush(); } 返回数组('entity'=& $ entity,'form'=& $ next_form-& createView()); }
我已经检查过,并验证,但一切似乎都可以。该实体是使用SF2控制台内的工具生成的。我做错了什么?
注意:我已经删除缓存
编辑: strong>
尝试所有其他实体,使用相同的命名空间,只是更改实体的名称,并声明对象,这似乎是与具有 _ 。
解决方案 通过删除实体名称中的_并更改其所有事件修正
本文地址: &
扫一扫关注官方微信Symfony2创建基于域名的路由(原创翻译) - 陈达辉 - 博客园
键盘上的生活
posts - 313, comments - 25, trackbacks - 4, articles - 5
你可以匹配将要来到的请求以HTTP域名的方式
mobile_homepage:
m.example.com
defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage }
defaults: { _controller: AcmeDemoBundle:Main:homepage }
&?xml version="1.0" encoding="UTF-8" ?&
&routes xmlns="/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="/schema/routing
/schema/routing/routing-1.0.xsd"&
&route id="mobile_homepage" path="/" host=""&
&default key="_controller"&AcmeDemoBundle:Main:mobileHomepage&/default&
&route id="homepage" path="/"&
&default key="_controller"&AcmeDemoBundle:Main:homepage&/default&
use Symfony\Component\Routing\RouteC
use Symfony\Component\Routing\R
$collection = new RouteCollection();
$collection-&add('mobile_homepage', new Route('/', array(
'_controller' =& 'AcmeDemoBundle:Main:mobileHomepage',
), array(), array(), ''));
$collection-&add('homepage', new Route('/', array(
'_controller' =& 'AcmeDemoBundle:Main:homepage',
return $collection;
两个路由匹配相同的路径 &/ ,然而第一个将只有域名为才匹配
使用占位符
这个域名选项使用占位符的路径匹配系统。这样就意味着你可以在你的域名中使用占位符匹配的域名。
projects_homepage:
"{project_name}."
defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage }
defaults: { _controller: AcmeDemoBundle:Main:homepage }
&?xml version="1.0" encoding="UTF-8" ?&
&routes xmlns="/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="/schema/routing
/schema/routing/routing-1.0.xsd"&
&route id="projects_homepage" path="/" host="{project_name}."&
&default key="_controller"&AcmeDemoBundle:Main:mobileHomepage&/default&
&route id="homepage" path="/"&
&default key="_controller"&AcmeDemoBundle:Main:homepage&/default&
use Symfony\Component\Routing\RouteC
use Symfony\Component\Routing\R
$collection = new RouteCollection();
$collection-&add('project_homepage', new Route('/', array(
'_controller' =& 'AcmeDemoBundle:Main:mobileHomepage',
), array(), array(), '{project_name}.'));
$collection-&add('homepage', new Route('/', array(
'_controller' =& 'AcmeDemoBundle:Main:homepage',
return $collection;
你还可以为这些占位符设置条件和默认的选项。列如,如果你想匹配&&&和你可以按照如下方式
mobile_homepage:
"{subdomain}."
_controller: AcmeDemoBundle:Main:mobileHomepage
subdomain: m
requirements:
subdomain: m|mobile
defaults: { _controller: AcmeDemoBundle:Main:homepage }
&?xml version="1.0" encoding="UTF-8" ?&
&routes xmlns="/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="/schema/routing
/schema/routing/routing-1.0.xsd"&
&route id="mobile_homepage" path="/" host="{subdomain}."&
&default key="_controller"&AcmeDemoBundle:Main:mobileHomepage&/default&
&default key="subdomain"&m&/default&
&requirement key="subdomain"&m|mobile&/requirement&
&route id="homepage" path="/"&
&default key="_controller"&AcmeDemoBundle:Main:homepage&/default&
use Symfony\Component\Routing\RouteC
use Symfony\Component\Routing\R
$collection = new RouteCollection();
$collection-&add('mobile_homepage', new Route('/', array(
'_controller' =& 'AcmeDemoBundle:Main:mobileHomepage',
'subdomain'
'subdomain' =& 'm|mobile',
), array(), '{subdomain}.'));
$collection-&add('homepage', new Route('/', array(
'_controller' =& 'AcmeDemoBundle:Main:homepage',
return $collection;
你还可以使用服务参数,如果你不想将域名写死写法如下
mobile_homepage:
"m.{domain}"
_controller: AcmeDemoBundle:Main:mobileHomepage
domain: '%domain%'
requirements:
domain: '%domain%'
defaults: { _controller: AcmeDemoBundle:Main:homepage }
&?xml version="1.0" encoding="UTF-8" ?&
&routes xmlns="/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="/schema/routing /schema/routing/routing-1.0.xsd"&
&route id="mobile_homepage" path="/" host="m.{domain}"&
&default key="_controller"&AcmeDemoBundle:Main:mobileHomepage&/default&
&default key="domain"&%domain%&/default&
&requirement key="domain"&%domain%&/requirement&
&route id="homepage" path="/"&
&default key="_controller"&AcmeDemoBundle:Main:homepage&/default&
use Symfony\Component\Routing\RouteC
use Symfony\Component\Routing\R
$collection = new RouteCollection();
$collection-&add('mobile_homepage', new Route('/', array(
'_controller' =& 'AcmeDemoBundle:Main:mobileHomepage',
'domain' =& '%domain%',
'domain' =& '%domain%',
), array(), 'm.{domain}'));
$collection-&add('homepage', new Route('/', array(
'_controller' =& 'AcmeDemoBundle:Main:homepage',
return $collection;
& & 确保你总是包含了默认的选项&domain占位符,否则你需要包含 domain的值每当你使用该路由生成URL的时候。
使用包含进来的路由规则匹配
&你可以设置域名选项通过导入路由配置文件,方式如下
acme_hello:
resource: '@AcmeHelloBundle/Resources/config/routing.yml'
&?xml version="1.0" encoding="UTF-8" ?&
&routes xmlns="/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="/schema/routing /schema/routing/routing-1.0.xsd"&
&import resource="@AcmeHelloBundle/Resources/config/routing.xml" host="" /&
use Symfony\Component\Routing\RouteC
$collection = new RouteCollection();
$collection-&addCollection($loader-&import("@AcmeHelloBundle/Resources/config/routing.php"), '', array(), array(), array(), '');
return $collection;
&将要被设置为加载进来的新路由配置文件中的每个路由
测试你的Controllers
你需要设置HTTP的域名头文件在你请求的对象中,如果你想正确的匹配到网址在你的测试函数中
$crawler = $client-&request(
'/homepage',
array('HTTP_HOST' =& 'm.' . $client-&getContainer()-&getParameter('domain'))你的位置: >
> 【Symfony2官方文档翻译】Book04:Doctrine02-数据库抽象层(DBAL)
原文出处:
原文作者:
翻译人员:FireHare
校对人员:FireHare
适用版本:Symfony 2
文章状态:已校对
Doctrine数据库抽象层(DBAL)是一个构建在PDO之上的抽象层,它为大多数流行的关系性数据库提供直接灵活的API。
你可以从官方文档中读到更多关于Doctrine DBAL 的内容。
首先,配置数据库连接参数:
# app/config/config.yml
password: null
DoctrineBundle支持缺省Doctrine驱动所接受的全部参数,Symfony2可以强制转换为XML或YAML的命名标准。更多细节请参见Doctrine DBAL 文档。
你可以通过database_connection服务来访问Doctrine DBAL连接。
class UserController extends Controller
public function indexAction()
$conn = $this-&get('database_connection');
$users = $conn-&fetchAll('SELECT * FROM users');
除了缺省的Doctrine选项外,你还可以配置一些Symfony相关的选项。下面显示所有可能的配置关键词:
driver_class:
MyNamespace\MyDriverImpl
%kernel.data_dir%/data.sqlite
unix_socket:
/tmp/mysql.sock
wrapper_class:
MyDoctrineDbalConnectionWrapper
%kernel.debug%
platform_service:
MyOwnDatabasePlatformService
如果你想在YAML中配置多个连接,请将它们放置在connections关键词下并赋予它们唯一的名字:
default_connection:
connections:
database_connection服务总是指向缺省连接的,该连接被第一个定义或使用default_connection参数的那个配置。
每个连接也可以通过doctrine.dbal.[name]_connection服务来访问,其中[name]是连接名。
注册自定义映射类型
你可以通过配置注册自定义的映射类型,它们将被添加到所有的配置连接中。
# app/config/config.yml
custom_first: Acme\HelloBundle\Type\CustomFirst
custom_second: Acme\HelloBundle\Type\CustomSecond
转载时请注明出处及相应链接,本文永久地址:/4447.html
支付宝打赏
感谢您对作者June的打赏,我们会更加努力!&&&&如果您想成为作者,
与本文相关的文章Symfony,Syrnfony,音标,读音,翻译,英文例句,英语词典
说明:双击或选中下面任意单词,将显示该词的音标、读音、翻译等;选中中文或多个词,将显示翻译。
您的位置: ->
-> Symfony
1)&&Syrnfony
2)&&SY alloy
In this paper, corrosion resistanced ultrahigh-strength steel SY alloy is investigated.
本文以耐蚀超高强度钢SY钢为研究对象,对该钢的断裂韧性和再结晶行为进行了研究。
3)&&SY Bank
A Case Study on Information System Construction for SY Bank;
SY银行信息化建设案例研究
4)&&SY company
SY company is the electrical enterprise which exist some difficult in financing process, because of itself characteristic and non-perfect external financing environment.
SY公司是一个从事电气行业的中小民营企业,其自身的特点和外部融资环境使得SY公司在融资中出现了一定的困难。
This thesis focuses on international distribution channel tactic and channel innovation, starting from the real practice of SY company and combining with the theory of international distribution channel and international trade, and work out the effective international marketing way based on competence promotion.
本论文的目的就是从位于甘肃兰州的SY微硅粉公司的实证分析出发,结合国际营销渠道和国际贸易的基本理论,对SY公司所采取的渠道策略和渠道变革进行研究,从而能够从SY公式改善国际营销渠道策略的个案中发掘出中小民营企业参与国际市场时基于竞争力提升的国际营销的有效方式,为众多中小民营企业能够参与到国际市场中去鼓舞士气和提供借鉴。
5)&&SY Heavy Industry
"To help employees succeed","quality changes the world "and "All for client" have been three core business philosophies by SY Heavy Industry since 2005.
2005年,SY重工将“帮助员工成功”与“品质改变世界”、“一切为了客户”列为SY的三大核心经营理念。
6)&&fertilizer with pesticide SY
补充资料:45钢和40Cr钢调质的热处理工艺
45钢40Cr钢调质&&&&&&&&&&&&&&&&&&&&&&&&&&&&&调质是淬火加高温回火的双重热处理,其目的是使工件具有良好的综合机械性能。&&&&调质钢有碳素调质钢和合金调质钢二大类,不管是碳钢还是合金钢,其含碳量控制比较严格。如果含碳量过高,调质后工件的强度虽高,但韧性不够,如含碳量过低,韧性提高而强度不足。为使调质件得到好的综合性能,一般含碳量控制在0.30~0.50%。&&&&调质淬火时,要求工件整个截面淬透,使工件得到以细针状淬火马氏体为主的显微组织。通过高温回火,得到以均匀回火索氏体为主的显微组织。小型工厂不可能每炉搞金相分析,一般只作硬度测试,这就是说,淬火后的硬度必须达到该材料的淬火硬度,回火后硬度按图要求来检查。&工件调质处理的操作,必须严格按工艺文件执行,我们只是对操作过程中如何实施工艺提些看法。&&&1、&45钢的调质&&&45钢是中碳结构钢,冷热加工性能都不错,机械性能较好,且价格低、来源广,所以应用广泛。它的最大弱点是淬透性低,截面尺寸大和要求比较高的工件不宜采用。&&&45钢淬火温度在A3+(30~50)&℃,在实际操作中,一般是取上限的。偏高的淬火温度可以使工件加热速度加快,表面氧化减少,且能提高工效。为使工件的奥氏体均匀化,就需要足够的保温时间。如果实际装炉量大,就需适当延长保温时间。不然,可能会出现因加热不均匀造成硬度不足的现象。但保温时间过长,也会也出现晶粒粗大,氧化脱碳严重的弊病,影响淬火质量。我们认为,如装炉量大于工艺文件的规定,加热保温时间需延长1/5。&&&因为45钢淬透性低,故应采用冷却速度大的10%盐水溶液。工件入水后,应该淬透,但不是冷透,如果工件在盐水中冷透,就有可能使工件开裂,这是因为当工件冷却到180℃左右时,奥氏体迅速转变为马氏体造成过大的组织应力所致。因此,当淬火工件快冷到该温度区域,就应采取缓冷的方法。由于出水温度难以掌握,须凭经验操作,当水中的工件抖动停止,即可出水空冷(如能油冷更好)。另外,工件入水宜动不宜静,应按照工件的几何形状,作规则运动。静止的冷却介质加上静止的工件,导致硬度不均匀,应力不均匀而使工件变形大,甚至开裂。
说明:补充资料仅用于学习参考,请勿用于其它任何用途。

我要回帖

更多关于 问题翻译 的文章

 

随机推荐