arg*_*son 2 php yaml doctrine symfony1 fixtures
我正在 Symfony 1.4(Doctrine 1.2)中使用 CMS 类型的站点,让我感到沮丧的一件事是无法在 YML 固定装置中存储 HTML 页面。相反,如果我想删除和重建数据,我必须创建数据的 SQL 备份,当 Symfony/Doctrine 有一个很好的机制来做到这一点时,这有点麻烦。
我可以编写一种机制,为每个页面读入一组 HTML 文件并以这种方式填充数据(甚至将其编写为任务)。但在我走这条路之前,我想知道是否有任何方法可以将 HTML 存储在 YML 固定装置中,以便 Doctrine 可以简单地将其导入数据库。
更新:
我曾尝试使用symfony doctrine:data-dump,symfony doctrine:data-load但是尽管转储正确创建了带有 HTML 的夹具,加载任务似乎“跳过”带有 HTML 的列的值,并将其他所有内容输入到行中。在数据库中,该字段不会显示为“NULL”,而是显示为空,因此我相信 Doctrine 会将列的值添加为“”。
下面是symfony doctrine:data-dump创建的 YML 夹具的示例。我尝试过symfony doctrine:data-load针对各种形式的这种情况运行,包括删除所有转义字符(新行和引号只留下尖括号),但它仍然不起作用。
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
Run Code Online (Sandbox Code Playgroud)
你可以使用下面的这种格式吗?
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">
<ul class="slider">
<li class="sliderItem" title="Summary">
<div class="feature">Some text goes in here</div>
</li>
<ul>
</div>
is_visible: true
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3260 次 |
| 最近记录: |