我在产品和颜色之间有很多关系.
我想要做的是按颜色找到产品.
例如)
$colours = $em->getRepository('Xxxxx\XxxxxBundle\Entity\Colour')->findBy(array('name'=>'red');
$products = $em->getRepository('Xxxxx\XxxxxBundle\Entity\Product')->findBy(array('colours'=>$colours));
Run Code Online (Sandbox Code Playgroud)
这是我的Yaml配置:
Xxxxx\XxxxxBundle\Entity\Product:
type: entity
manyToMany:
colours:
targetEntity: Colour
joinTable:
name: Product_Colour
joinColumns:
product_id:
referencedColumnName: id
inverseJoinColumns:
colour_id:
referencedColumnName: id
Run Code Online (Sandbox Code Playgroud)
.
Xxxxx\XxxxxBundle\Entity\Colour:
type: entity
id:
id:
type: integer
generator:
strategy: AUTO
fields:
hex:
type: string
length: 320
name:
type: string
length: 320
Run Code Online (Sandbox Code Playgroud)
我得到的错误消息是:
Notice: Undefined index: joinColumns in /home/xxx/public_html/products/vendor/doctrine/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php line 1217
Run Code Online (Sandbox Code Playgroud)
是否有人能够阐明为什么这不起作用.
我正在根据鼠标位置旋转一个立方体.
鼠标在屏幕上随时都有X坐标和Y坐标.
我使用jquery .mousemove()来确定像素坐标,然后在mousemove函数内部,我调整css rotate3d角度来移动对象.
这一切都很好,但我想根据x和y位置移动对象.理想情况下......
'-webkit-transform': 'rotate3d(1,0,0,'+angleX+'deg)',
'-webkit-transform': 'rotate3d(0,1,0,'+angleY+'deg)',
Run Code Online (Sandbox Code Playgroud)
但这当然不起作用.
如何让两个轴同时旋转不同的量?
所以一种方法是..
if(isset($arrayVar)) {
if(is_array($arrayVar)) {
if(count($arrayVar) > 0) {
// Success
print_r($arrayVar);
}
}
}
Run Code Online (Sandbox Code Playgroud)
有没有更好的方法?