我们先来描述一下我的情况.我正在使用Symfony2,我的实体之间的关系有问题.
我有两个链接在一起的实体.这两个实体是AssociationQuestion和AssociationPossibleAnswer.我目前正在创建一个问题软件,其中必须将左侧的一个可能答案与右侧的另一个可能答案相关联,例如在以下示例中:

目前,我正计划在类中使用两个属性来AssociationQuestion保存许多AssociationPossibleAnswer对象.第一个数组将包含左侧可能的答案,第二个数组将包含右侧可能的答案.
因此,对我来说,看起来我将有两个oneToMany关系 AssociationQuestion
AssociationQuestion:
oneToMany:
possibleAnswersLeft:
targetEntity: AssociationPossibleAnswer
mappedBy: associationQuestion
possibleAnswersRight:
targetEntity: AssociationPossibleAnswer
mappedBy: associationQuestion
Run Code Online (Sandbox Code Playgroud)
然后,在AssociationPossibleAnswer,我会有一个ManyToOne关系:
AssociationPossibleAnswer:
manyToOne:
associationQuestion:
targetEntity: AssociationQuestion
Run Code Online (Sandbox Code Playgroud)
问题是我在尝试验证我的学说时遇到以下错误.似乎你不能像我希望的那样将两个实体链接到一个......
* The field AssociationQuestion#possibleAnswersLeft is on the inverse side of a bi-directional relationship, but the specified mappedBy association on the target-entity AssociationPossibleAnswer#associationQuestion does not contain the required 'inversedBy=possibleAnswersLeft' attribute.
* The field AssociationQuestion#possibleAnswersRight is on the inverse side of a bi-directional relationship, but the specified mappedBy …Run Code Online (Sandbox Code Playgroud) 我想生成一个新的bundle但是它说命令生成:bundle没有定义.
当我尝试这个命令时:
php app/console list --raw
Run Code Online (Sandbox Code Playgroud)
generate:bundle未显示...
输出命令:
help Displays help for a command
list Lists commands
assetic:dump Dumps all assets to the filesystem
assets:install Installs bundles web assets under a public web directory
cache:clear Clears the cache
cache:warmup Warms up an empty cache
config:dump-reference Dumps default configuration for an extension
container:debug Displays current services for an application
doctrine:cache:clear-metadata Clears all metadata cache for an entity manager
doctrine:cache:clear-query Clears all query cache for an entity manager
doctrine:cache:clear-result Clears result cache …Run Code Online (Sandbox Code Playgroud) 我创建了一个名为 img 的文件夹,其中包含一些图像。但是,当我尝试在 url 中访问它时,例如:
http://mydomain.dev/app_dev.php/img/1.png
Run Code Online (Sandbox Code Playgroud)
它不起作用
Symfony 向我返回一个错误消息:找不到“GET /img/1.png”的路由
但是,如果我执行以下操作:
http://mydomain.dev/img/1.png
Run Code Online (Sandbox Code Playgroud)
有用 !
我正在使用 Apache 并在 Mac OSX Mavericks 上运行它。
即使它不是路由而是文件,我如何在 app_dev.php 中访问它?
我不知道我做错了什么,但这就是我想要的.
首先,这是我的身体:
<body>
<div ng-app="testApp" ng-controller="MainController" class="container-fluid">
<div ui-view class="row"></div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
现在,在ui-view中,我想要一些内容,具体取决于URL.首先,将有包含其他州的家乡.
- Home
- Recent Studies
- Studies
- Map
- Study
Run Code Online (Sandbox Code Playgroud)
为此,我正在尝试创建路由层次结构.这将是我的主页模板(home.html),一个抽象的模板,将在ui-view上面进行:
<div ng-controller="HomeController">
<header>
<div class="row">
<div class="col-xs-6">Test Web Application</div>
<div class="col-xs-6">
<p class="pull-right">Bonjour
<strong>{{currentAccount.name}}</strong> !
<a href="#">Déconnexion</a></p>
</div>
</div>
</header>
<article class="row">
<div ui-view></div>
</article>
</div>
Run Code Online (Sandbox Code Playgroud)
这是最近的研究(home.recentStudies.html.twig),我想把它放在home.html的ui-view里面:
<p>Recent studies</p>
Run Code Online (Sandbox Code Playgroud)
以下是路线定义:
angular.module('testApp').config(['$stateProvider', '$urlRouterProvider',
function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/recentStudies');
$stateProvider
.state('home', {
url: '/',
abstract: true,
templateUrl: 'partials/home.html'
})
.state('home.recentStudies', {
url: …Run Code Online (Sandbox Code Playgroud) 如果我删除condition=\''.$this->condition.'\',它的工作线.
如果我在那里,会出现以下错误消息:
您的SQL语法有错误; 检查与您的MySQL服务器版本对应的手册,以便在'condition ='unknown',promotional ='0',website ='0',quantity ='1','在第7行附近使用正确的语法
mysql_query('UPDATE products SET
name = \''.$this->name.'\',
description = \''.$this->description.'\',
brand = \''.$this->brand.'\',
model = \''.$this->model.'\',
price=\''.$this->price.'\',
condition=\''.$this->condition.'\',
promotional=\''.$this->promotional.'\',
website=\''.$this->website.'\',
quantity=\''.$this->quantity.'\',
service=\''.$this->service.'\'
WHERE id = \''.$this->id.'\' '
Run Code Online (Sandbox Code Playgroud) 我需要在VBA中声明一个将由每个函数使用的数组.但是,我不能像在C++中那样将它声明为全局.
我的代码如下:
Option Explicit
Dim test(0 to 10) as String
test(0) = "avds"
test(1) = "fdsafs"
....
Run Code Online (Sandbox Code Playgroud)
以下概述了我想要做的事情.
public function store() as boolean
Worksheets("test").cells(1,1) = test(0)
End Function
Run Code Online (Sandbox Code Playgroud)
我该如何实现此功能?
我正在使用ssh连接到我的ubuntu服务器.我使用命令启动编码程序.但是,似乎当我的ssh会话关闭时(因为我是在睡觉的笔记本电脑上启动的).有没有办法避免这种情况(当然防止我的笔记本电脑睡觉不是一个永久的解决方案).
我想在我的一个视图中集成cocos2d.所以,我有一个普通的视图controller(MapEditorViewController)和一个视图,在我的视图控制器中,(我创建了一个IBOutlet UIView *openGLView)我希望cocos2d在其中.在我的视图控制器中,我有一个方法setupCocos2D:
- (void)setupCocos2D {
CCGLView *glView = [CCGLView viewWithFrame:self.openGLView.bounds
pixelFormat:kEAGLColorFormatRGB565 // kEAGLColorFormatRGBA8
depthFormat:0 // GL_DEPTH_COMPONENT16_OES
];
glView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.openGLView insertSubview:glView atIndex:0];
[[CCDirector sharedDirector] setOpenGLView:glView];
CCScene *scene = [HelloWorldLayer scene];
[[CCDirector sharedDirector] runWithScene:scene];
}
Run Code Online (Sandbox Code Playgroud)
setupCocos2D被称为viewDidLoad班级MapEditorViewController.
我有一个layer(HelloWorldLayer),它基本上是http://www.raywenderlich.com/25736/how-to-make-a-simple-iphone-game-with-cocos2d-2-x-教程中的代码.教程
// Helper class method that creates a Scene with the HelloWorldLayer as the only child.
+(CCScene *) scene
{
// 'scene' is an autorelease object.
CCScene …Run Code Online (Sandbox Code Playgroud) 我正在使用Symfony2,我有一个类的层次结构.层次结构非常简单,我有一个问题(父母)和许多不同的子问题.使用Sonata,我希望能够创建不同类型的问题,即子问题.为此,我创建了一个类的层次结构,如下所示:
Hippy\ScavengerHuntBundle\Entity\Question:
type: entity
table: null
inheritanceType: JOINED
discriminatorColumn:
name: subClass
type: string
discriminatorMap:
blurredMultipleChoiceQuestion: BlurredMultipleChoiceQuestion
blurredTextQuestion: BlurredTextQuestion
slidingPuzzleQuestion: SlidingPuzzleQuestion
associationQuestion: AssociationQuestion
trueOrFalseQuestion: TrueOrFalseQuestion
lettersInOrderQuestion: LettersInOrderQuestion
shortTextQuestion: ShortTextQuestion
multipleChoiceQuestion: MultipleChoiceQuestion
sentenceGapQuestion: SentenceGapQuestion
fields:
id:
type: integer
id: true
generator:
strategy: AUTO
title:
type: string
length: 255
position:
type: integer
lifecycleCallbacks: { }
Run Code Online (Sandbox Code Playgroud)
我将向您展示一个子类的示例
Hippy\ScavengerHuntBundle\Entity\LettersInOrderQuestion:
type: entity
table: null
fields:
description:
type: text
lifecycleCallbacks: { }
<?php
namespace Hippy\ScavengerHuntBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* LettersInOrderQuestion
*/
class LettersInOrderQuestion extends Question …Run Code Online (Sandbox Code Playgroud) 我有一种清道夫追捕项目,我使用AngularJS来管理它可能包含的不同问题.这些问题属于不同类型.因此,有些可能包含文件输入,有些可能不包括.在这个项目中,我还使用Symfony和SonataMediaBundle来管理我的文件和图像.
由于我的html模型(主要是我的表单)可以根据用户的操作而改变,我不能使用Symfony的内置工具来生成表单.因此,我的所有表格都是定制的.当我想要上传一些文件时,这给了SonataMediaBundle一个问题.如果用户选择文件,则在发送表单时,此文件将通过POST发送到控制器中的方法.因此,我想将这个收到的文件发送到SonataMediaBundle,以便它可以管理它,但我没有在文档中的任何地方找到如何做这样的事情.
从理论上讲,它非常简单.在我的控制器中,当我收到文件输入时,我想让SonataMedia管理上传(即复制到正确的位置等等),我不知道该怎么做.
php ×6
symfony ×5
angularjs ×2
sonata-admin ×2
arrays ×1
doctrine-orm ×1
excel-vba ×1
ios ×1
ipad ×1
iphone ×1
javascript ×1
linux ×1
many-to-one ×1
mysql ×1
objective-c ×1
one-to-many ×1
scope ×1
shell ×1
sql ×1
state ×1
ubuntu ×1
vba ×1