我被困在这里,在wamp我运行一切并且工作正常,但是,当我尝试在一个centos盒子中安装我的api时,我总是得到一个"Not Found"错误.
我不知道还能做什么!
甚至说/你好的例子都失败了......
是否有任何apache要求的规范来处理restler?
有什么想法吗?有点急
say.php:
<?php
class Say {
function hello($to='world') {
return "Hello $to!";
}
}
Run Code Online (Sandbox Code Playgroud)
的index.php
<?php
require_once 'restler/restler.php';
require_once 'say.php';
$r = new Restler();
$r->addAPIClass('Say');
$r->setSupportedFormats('jsonpformat', 'jsonformat', 'xmlformat', 'yamlformat');
$r->handle();
Run Code Online (Sandbox Code Playgroud)
的.htaccess
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ index.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<IfModule mod_php5.c>
php_flag display_errors On
</IfModule>
Run Code Online (Sandbox Code Playgroud)
错误:
未找到 在此服务器上找不到请求的URL/mylocation/say/hello.
这基本上就是我的所有代码,如果你们认为jsonpformat可能会按照我的方式进行,我可以在这里粘贴代码.
当我输入这样的URL:http://myhost/mylocation/我得到一个json错误:
{
"error": {
"code": 404,
"message": "Not Found" …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用以下命令从我的项目运行单元测试:
xcodebuild test -scheme 'WaveIt' -destination 'platform=iOS Simulator,name=iPhone 6,OS=8.4'
Run Code Online (Sandbox Code Playgroud)
但我得到了这个:
ld:找不到 -lSocketRocket clang 的库:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
测试失败:链接器命令失败,退出代码为 1(使用 -v 查看调用)** 测试失败 **
以下构建命令失败:Ld DerivedData/WaveIt/Build/Products/Debug-iphonesimulator/WaveIt.app/WaveIt 正常 x86_64(1 次失败)
我的项目包括带有 cocoaPods 的库:
和 Alamofire(git 子模块)
谁能告诉我有什么问题吗?
问候
我ng-repeat里面有一堆单选按钮:
<div class="panel panel-default" ng-repeat="offer in vm.offerList">
...
<td ng-show="offer.edit">
<div class="row">
<input type="radio" name="before" ng-model="offer.before" value="false">
<input type="radio" name="before" ng-model="offer.before" value="true">
</div>
</td>
...
</div>
Run Code Online (Sandbox Code Playgroud)
该模型offer.before具有正确的值,但是,当显示该行时,单选按钮未显示为选中状态。为什么会这样呢?我需要单选按钮以显示选定的值。
这是我的问题的一个小提琴例子:http : //jsfiddle.net/danielrvt/dpoLdgjq/
每次我想将它添加到关系中时,我发现必须从数据库中通过id获取对象非常烦人.有没有办法通过id向对象添加对象而不是添加整个对象?
这是我的实际代码:
...
$person = $em->getRepository("Person")->findOneById($id);
$me->getPersons()->add($person);
...
Run Code Online (Sandbox Code Playgroud)
我想要这样的东西:
...
$me->getPersons()->add($id);
...
Run Code Online (Sandbox Code Playgroud)
然后我会保存一次数据库之旅!我更喜欢哪个!可能吗?
我有几个Option对象,比如a,b和c.如果它们不是None这样的话我想连接它们的值:
var str = "values: "
if (!a.isEmpty) str = str + a.get
if (!b.isEmpty) str = str + b.get
if (!c.isEmpty) str = str + c.get
Run Code Online (Sandbox Code Playgroud)
这是非常必要和javaish.有没有更好的方法来使用Scala并仍然保持代码可读?
谢谢!
我已经更改了实体的主键,但现在我收到了这个错误:
ReflectionException Property DnD\\ApiBundle\\Entity\\Agent::$id does not exist
Run Code Online (Sandbox Code Playgroud)
我的实体是这样的:
<?php
namespace DnD\ApiBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\Groups;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\Column;
/**
* Agent
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="DnD\ApiBundle\Repository\AgentRepository")
*/
class Agent
{
/**
* @var string
*
* @Groups({"list", "details"})
* @Id
* @Column(type="string", length=255)
*/
private $agentId;
...
Run Code Online (Sandbox Code Playgroud)
我已经清除了doctrine缓存,但错误仍然存在.为什么会这样呢?
谢谢!
我试图从父实体中删除注释,我记得在我的上一个网站上这样做,但现在它不起作用..
我的实体 - 用户
namespace Application\Entities;
use Doctrine\ORM\Mapping AS ORM,
Doctrine\Common\Collections\ArrayCollection;
/**
* Loan
*
* @ORM\Table(name="users")
* @ORM\Entity
*/
class Users{
/**
* @var integer $id
*
* @ORM\Column(type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string $username
*
* @ORM\Column(type="string", length=45, nullable=false)
*/
private $username;
/**
* @var ArrayCollection
*
* @ORM\OneToMany(targetEntity="Comments", mappedBy="author", cascade={"persist", "remove"})
*/
private $comments;
public function getComments(){
return $this->comments;
}
Run Code Online (Sandbox Code Playgroud)
和我的评论表:
namespace Application\Entities;
use Doctrine\ORM\Mapping AS ORM,
Doctrine\Common\Collections\ArrayCollection;
/**
* …Run Code Online (Sandbox Code Playgroud) 我有一个实体,我想在我正在开发的 JSON API 中公开它,问题是在这个特定的控制器中,只有一个我不想公开的字段。有没有办法将其从控制器内的序列化中排除?
我知道我可以注释我的实体,以便序列化器仅传递该字段,但在所有其他情况下会发生什么?这确实是个例外。
有没有办法用打字稿,重命名属性名称或其他东西来做这样的事情?
interface Person {
name: string
age: number
}
interface Pet {
age: string
}
interface Zoo extends Pet, Person {}
Run Code Online (Sandbox Code Playgroud)
没有收到此错误:
接口“动物园”不能同时扩展类型“人”和“宠物”类型“人”和“宠物”的命名属性“年龄”不相同。ts(2320)
[编辑]
我正在寻找一种方法来获得这个结果:
interface Zoo {
name: string
age: number
}
Run Code Online (Sandbox Code Playgroud) Controller's Action当用户未使用自定义注释登录时,我似乎无法确定是否可以保护.
这就是我想要实现的目标:
...
class FooController extends Controller
{
...
/*
* The code bellow should only be executed if the user
* is authorized, otherwise should throw an exception
* or something.
*
* @Authorized
*/
public function barAction($cid) {
// do stuff only if user is authorized
}
...
}
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用某种" 装饰器设计模式 " 来做到这一点,但我真正想要的是更像Python的使用PHP 注释的装饰器
这是真的吗?我该怎么办?
php ×5
symfony ×4
doctrine-orm ×2
angularjs ×1
annotations ×1
api ×1
decorator ×1
doctrine ×1
html ×1
inheritance ×1
ios ×1
javascript ×1
jenkins ×1
json ×1
primary-key ×1
python ×1
radio-button ×1
rest ×1
restler ×1
scala ×1
string ×1
swift ×1
typescript ×1
unit-testing ×1
web-services ×1