我想从数据库中获取$id和$name,但我得到这个异常:
对于Grupa\ProjektBundle\Entity\Car的查询,缺少标识符ID
我GeneratedValue(strategy="AUTO")在实体中有Doctrine注释Car.我怎样才能解决这个问题?路由匹配!
另外,我有一个id为1的数据库条目和一个指向图像的URL值的名称(http://www.supercarworld.com/images/fullpics/595.jpg).
这是我的控制器名为SupercarsController.php:
namespace Grupa\ProjektBundle\Controller;
use Grupa\ProjektBundle\Entity\Car;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class SupercarsController extends Controller
{
public function scAction($id = null, $name = null){
$car = new Car();
// $car->setName('http://www.supercarworld.com/images/fullpics/595.jpg');
// em entity manager
// $em = $this->getDoctrine()->getManager();
// $em->persist($car);
// $em->flush();
$car = $this->getDoctrine()
->getRepository('GrupaProjektBundle:Car')
->find($id, $name);
return $this->render('GrupaProjektBundle:Sc:supercars.html.twig');
}
public function showAction($slug)
{
$url = $this->generateUrl('grupa_projekt_supercars',
array('slug' => 'marka')
);
return $this->render('GrupaProjektBundle:Sc:makes.html.twig');
}
} …Run Code Online (Sandbox Code Playgroud) 您好,我得到了HTMLButtonElement 对象,
因为var btn = document.createElement('button');这是正常行为,但如何才能将普通按钮作为图形而不是对象获取?IE<button type="button">
就像将对象转换为字符串一样,但在这种情况下对象是什么?
线性插值有什么问题?
在 update() 中,如果这是 animate() 并且当我在 update() 中调用 ZoomCamera() 时,有平滑的 lerp 但当我在这里调用时
function onObjectsClick(event) {
event.preventDefault();
setPickPosition(event);
raycasting(pickPosition, scene, camera);
pickedObject = intersectedObjects[0].object;
const notebook = pickedObject.getObjectByName('notebook');
const laptop = pickedObject.getObjectByName('laptop');
if (notebook || laptop) {
zoomCamera();
}
}
canvas.addEventListener('click', onObjectsClick, false);
Run Code Online (Sandbox Code Playgroud)
如果 没有平滑的 lerp 但急剧的过渡我会错过什么?
function zoomCamera() {
const vec = new THREE.Vector3(-1, 2, 2);
const alpha = .1;
camera.position.lerp(vec, alpha);
console.log('zoom');
}
Run Code Online (Sandbox Code Playgroud)
onObjectsClick 是在 animate() 中,
为什么会发生?