我试图从MongoDB中检索对象,但我面临一个问题,即它返回基类型的元素而不是子元素而且它引起了麻烦,我发现它以某种方式依赖于属性的值.
/**
* @MongoDB\Document(
* collection="zoo",
* repositoryClass="ZooRepository",
* )
*/
class Zoo
{
/**
* @MongoDB\ReferenceMany(targetDocument="Animal", inversedBy="zoo", strategy="addToSet")
* @var \Doctrine\Common\Collections\ArrayCollection
*/
protected $animals;
/**
* @return mixed
*/
public function getAnimals()
{
return $this->animals->toArray();
}
//Some more code
}
/**
* @MongoDB\Document(
* repositoryClass="AnimalRepository",
* collection="animals"
* )
* @MongoDB\InheritanceType("SINGLE_COLLECTION")
* @MongoDB\DiscriminatorField("discriminator")
* @MongoDB\DiscriminatorMap({
* "animal"="Animal",
* "birds"="Bird",
* "mamals"="Mamals"})
*/
class Animal
{
/**
* @MongoDB\ReferenceMany(targetDocument="Location", mappedBy="animals", simple=true, cascade={"persist"})
*
* @Assert\Count(min="0", max="1")
*/
protected $locations;
} …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用maven在teamcity上构建一个项目,并在maven构建步骤中获取此错误.
[步骤2/4] [ERROR] protoc输出失败:
[步骤2/4] [错误] protoc失败错误:/ bin/sh:1:protoc:权限被拒绝[步骤2/4] [13:03:14] [步骤2/4]无法在项目unit-protocol-lib上执行目标com.google.protobuf.tools:maven-protoc-plugin:0.1.10:compile(generate-sources):protoc没有干净地退出.查看输出以获取更多信息.
请记住,我使用docker-compose构建teamcity代理(在容器中运行的代理),并将protoc添加到/ usr/local/bin/protoc($ PATH具有/ usr/local/bin,/ usr/local/bin/protoc具有rwx权限).
编辑方便
暂时忘掉上面的一切.
我登录了teamcity服务器的buildagent,使用/bin/sh并执行命令访问shell protoc并返回错误:
protoc failed error: /bin/sh: 1: protoc: Permission denied
任何帮助?
我正在尝试第一次使用log4j,并且已经正确配置了它,我只是想知道如何打印作为第二个参数传递的参数的详细信息:
LogManager.getLogger(SomeName.class.getName()).info(message, detail);
Run Code Online (Sandbox Code Playgroud)
而我的配置附加程序是:
<File name="file1" fileName="output.log">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</File>
Run Code Online (Sandbox Code Playgroud)
我想%msg如果要在此记录详细信息,则模式中应该有一些切换。但是我不确定是什么或如何。