我已经设置了一个Firebase项目来创建一些基本的Firebase功能.
在我正在使用TypeScript的项目中
在Firebase官方文档之后,我创建了我的项目.
最后一步,firebase deploy --only functions该tsc命令出错.
$ firebase deploy --only functions
=== Deploying to ‘my-project’…
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions@ lint /path/to/functions
> tslint --project tsconfig.json
Running command: npm --prefix "$RESOURCE_DIR" run build
> functions@ build /path/to/functions
> tsc
node_modules/firebase-functions/lib/function-builder.d.ts(60,95): error TS1005: ';' expected.
node_modules/firebase-functions/lib/function-builder.d.ts(60,96): error TS1003: Identifier expected.
node_modules/firebase-functions/lib/function-builder.d.ts(60,116): error TS1005: ';' expected.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ build: …Run Code Online (Sandbox Code Playgroud) node.js firebase typescript google-cloud-functions firebase-cli
当我将文件上传到 Symfony 时,它会按应有的方式上传。我已经使用了 Symfony 文件上传教程并对其进行了修改以满足我的需要。
if($form->isValid())
{
$em = $this->oStarter->getEntityManager();
// Save file to database
$uploadedFile = new ProfilePicture();
$uploadedFile->setFile($formData["profile_picture"]);
$user->setProfilePicture($uploadedFile);
$uploadedFile->setUser($user);
$em->persist($uploadedFile);
$em->persist($user);
$em->flush();
// Other things like Twig templates etc..
Run Code Online (Sandbox Code Playgroud)
此代码用于上传图像并将其设置为用户的个人资料图片。$this->getUser()通过在控制器中找到用户。当我在刷新后输出实体时,它会向我显示有效实体的转储,就像我所期望的那样。
当我访问该用户的个人资料页面时,找不到该图像。当我检查 MySQL 表时,我发现 ProfilePicture 的有效条目具有正确的 ID 和路径。正如您所期望的,用户还可以引用 ProfilePicture 的 ID。相反,该页面向我显示以下转储:
$avatar = $user->getProfilePicture();
$path = $avatar->getWebPath();
Debug::dump($avatar);
object(stdClass)#938 (8)
{
["__CLASS__"]=>
string(42) "Takeabyte\CoreBundle\Entity\ProfilePicture"
["__IS_PROXY__"]=>
bool(true)
["__PROXY_INITIALIZED__"]=>
bool(false)
["id"]=>
NULL
["user"]=>
object(stdClass)#1011 (52) {
["__CLASS__"]=>
string(32) "Takeabyte\CoreBundle\Entity\User"
["id"]=>
int(11)
// lots of user info
}
["file"]=> …Run Code Online (Sandbox Code Playgroud) 我正在编写一些PHP代码来将值插入到我的MySQL数据库中:
INSERT INTO users_validate (uid, key) VALUES ('11', '4866ce5568850eb5f8daad79a8822d26')
Run Code Online (Sandbox Code Playgroud)
谁能告诉我这有什么问题?
编辑:错误消息是
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key) VALUES ('11', '4866ce5568850eb5f8daad79a8822d26')' at line 1
Run Code Online (Sandbox Code Playgroud) mysql ×2
doctrine-orm ×1
firebase ×1
firebase-cli ×1
node.js ×1
php ×1
symfony ×1
typescript ×1