Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"doctrine:mapping:import" does not escape quotes in field comments #7763

Closed
guillaume-a opened this issue Jun 27, 2019 · 2 comments
Closed
Assignees
Labels
Milestone

Comments

@guillaume-a
Copy link
Contributor

guillaume-a commented Jun 27, 2019

Bug Report

Hi, I made this repo to reproduce easily this bug : https://github.com/guillaume-a/doctrine-orm-7763

I don't really know how to create a PR, and I don't event know if my solution is the best way.

Q A
BC Break no
Version 2.6.3

Summary

After creating the following table in my DB

CREATE TABLE `unicorn` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(40) NOT NULL COMMENT 'enter a "comment" here'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

I try to import the mapping and generate getters/setters.
The following exception appears

In AnnotationException.php line 42:
                                                                                 
  [Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_CLOSE_CURLY_B  
  RACES, got 'comment' at position 122 in property App\Entity\Unicorn::$name

Because the annotation generated for the 'name' field is as :

// src/Entity/Unicorn.php
/**
 * @var string
 *
 * @ORM\Column(name="name", type="string", length=40, nullable=false, options={"comment"="enter a "comment" here"})
 */
private $name;

How to reproduce

Follow README.md from https://github.com/guillaume-a/doctrine-orm-7763

Expected behavior

We expected quotes to be escaped or doubled like so :

// src/Entity/Unicorn.php
/**
 * @var string
 *
 * @ORM\Column(name="name", type="string", length=40, nullable=false, options={"comment"="enter a ""comment"" here"})
 */
private $name;
guillaume-a added a commit to guillaume-a/orm that referenced this issue Jun 27, 2019
@guillaume-a
Copy link
Contributor Author

made this PR : #7764

lcobucci pushed a commit to guillaume-a/orm that referenced this issue Oct 2, 2019
@lcobucci lcobucci self-assigned this Oct 2, 2019
@lcobucci lcobucci added the Bug label Oct 2, 2019
@lcobucci lcobucci added this to the 2.6.5 milestone Oct 2, 2019
@lcobucci
Copy link
Member

lcobucci commented Oct 2, 2019

Handled by #7764. Thanks @guillaume-a 👍

@lcobucci lcobucci closed this as completed Oct 2, 2019
lcobucci added a commit that referenced this issue Oct 2, 2019
#7763 escape quotes in field comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants