How can I store HTML in a Doctrine YML fixture

Posted by argibson on Stack Overflow See other posts from Stack Overflow or by argibson
Published on 2010-03-30T23:51:20Z Indexed on 2010/04/01 11:23 UTC
Read the original article Hit count: 396

Filed under:
|
|
|
|

I am working with a CMS-type site in Symfony 1.4 (Doctrine 1.2) and one of the things that is frustrating me is not being able to store HTML pages in YML fixtures. Instead I have to create SQL backups of the data if I want to drop and rebuild which is a bit of a pest when Symfony/Doctrine has a fantastic mechanism for doing exactly this.

I could write a mechanism that reads in a set of HTML files for each page and fills the data in that way (or even write it as a task). But before I go down that road I am wondering if there is any way for HTML to be stored in a YML fixture so that Doctrine can simply import it into the database.

Update:

I have tried using symfony doctrine:data-dump and symfony doctrine:data-load however despite the dump correctly creating the fixture with the HTML, the load task appears to 'skip' the value of the column with the HTML and enters everything else into the row. In the database the field doesn't show up as 'NULL' but rather empty so I believe Doctrine is adding the value of the column as ''.

Below is a sample of the YML fixture that symfony doctrine:data-dump created. I have tried running symfony doctrine:data-load against various forms of this including removing all the escaped characters (new lines and quotes leaving only angle brackets) but it still doesn't work.

  Product_69:
    name: 'My Product'
    Developer: Developer_30
    tagline: 'Text that briefly describes the product'
    version: '2008'
    first_published: ''
    price_code: A79
    summary: ''
    box_image: ''
    description: "<div id=\"featureSlider\">\n    <ul class=\"slider\">\n        <li class=\"sliderItem\" title=\"Summary\">\n            <div class=\"feature\">\n              Some text goes in here</div>\n        </li>\n    </ul>\n  </div>\n"
    is_visible: true

© Stack Overflow or respective owner

Related posts about doctrine

Related posts about symfony