Я пытаюсь настроить Symfony 1.4.Я не новичок в MVC, но это моя первая попытка Symfony.Я следил за документацией на symfony-project.org/reference/1_4, и у меня есть «Hello, World!»стр.
Я перешел к следующему шагу - базе данных.
Я сделал это (не волнуйтесь. Только localhost :)):
./symfony configure:database "mysql:host=localhost;dbname=myblog" myblog myblog
Затем я поместил это в мой файл config / doctrine / schema.yml:
Article:
actAs: [Sluggable, Timestampable]
columns:
title:
type: string(255)
notnull: true
content:
type: clob
status: string(255)
author_id: integer
category_id: integer
published_at: timestamp
relations:
Author:
foreignAlias: Articles
Category:
foreignAlias: Articles
Tags:
class: Tag
refClass: ArticleTag
foreignAlias: Articles
Author:
columns:
first_name: string(20)
last_name: string(20)
email: string(255)
active: boolean
Category:
columns:
name: string(255)
Tag:
columns:
name: string(255)
ArticleTag:
columns:
article_id:
type: integer
primary: true
tag_id:
type: integer
primary: true
relations:
Article:
onDelete: CASCADE
Tag:
onDelete: CASCADE
Но я получаю следующее:
charlie@mystery:~/sfproject$ ./symfony doctrine:build --all-classes
>> doctrine generating model classes
>> file+ /tmp/doctrine_schema_30022.yml
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BaseArticleTag.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BasePost.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BaseCategory.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BaseArticle.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BaseAuthor.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BaseTag.class.php
>> autoload Resetting application autoloaders
>> file- /home/charlie/sfproject/cache/frontend/dev/config/config_autoload.yml.php
>> doctrine generating form classes
PHP Fatal error: Class 'columns' not found in /home/charlie/sfproject/lib/model/doctrine/base/BasePost.class.php on line 25
Fatal error: Class 'columns' not found in /home/charlie/sfproject/lib/model/doctrine/base/BasePost.class.php on line 25
PHP Fatal error: Call to a member function evictAll() on a non-object in /home/charlie/sfproject/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 1239
Fatal error: Call to a member function evictAll() on a non-object in /home/charlie/sfproject/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 1239
Я пробовал несколько разных файлов примеров для моего schema.ywl, поэтому я не думаю, что он некорректен.Должно быть, я пропустил шаг.
Что-то не так, но я в полном замешательстве.Буду очень признателен за любую помощь!
Редактировать Моя оригинальная конфигурация / doctrine / schema.yml была:
Posts:
actAs:
Timestampable: ~
columns:
title: string(255)
body: clob
Редактировать 2 За Майказапрос, я отредактировал файл так:
Article:
actAs: { Timestampable: ~ }
columns:
title:
type: string(255)
notnull: true
content:
type: clob
status: string(255)
author_id: integer
category_id: integer
published_at: timestamp
relations:
Author:
foreignAlias: Articles
Category:
foreignAlias: Articles
Tags:
class: Tag
refClass: ArticleTag
foreignAlias: Articles
Author:
columns:
first_name: string(20)
last_name: string(20)
email: string(255)
active: boolean
Category:
columns:
name: string(255)
Tag:
columns:
name: string(255)
ArticleTag:
columns:
article_id:
type: integer
primary: true
tag_id:
type: integer
primary: true
relations:
Article:
onDelete: CASCADE
Tag:
onDelete: CASCADE
Ошибка:
charlie@mystery:~/sfproject$ ./symfony doctrine:build --all-classes
>> doctrine generating model classes
>> file+ /tmp/doctrine_schema_79366.yml
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BaseArticleTag.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BasePost.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BasePosts.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BaseCategory.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BaseArticle.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BaseAuthor.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BaseTag.class.php
>> autoload Resetting application autoloaders
>> doctrine generating form classes
PHP Fatal error: Class 'columns' not found in /home/charlie/sfproject/lib/model/doctrine/base/BasePost.class.php on line 25
Fatal error: Class 'columns' not found in /home/charlie/sfproject/lib/model/doctrine/base/BasePost.class.php on line 25
PHP Fatal error: Call to a member function evictAll() on a non-object in /home/charlie/sfproject/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 1239
Fatal error: Call to a member function evictAll() on a non-object in /home/charlie/sfproject/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 1239
charlie@mystery:~/sfproject$
Редактировать По совету Майка по ручной сборке я получаю ту же ошибкупо доктрине: build-фильтры и доктрины: build-формы:
charlie@mystery:~/sfproject$ php symfony doctrine:build-model
>> doctrine generating model classes
>> file+ /tmp/doctrine_schema_91741.yml
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BaseArticleTag.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BasePost.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BasePosts.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BaseCategory.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BaseArticle.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BaseAuthor.class.php
>> tokens /home/charlie/sfproject/lib/model/doctrine/base/BaseTag.class.php
>> autoload Resetting application autoloaders
>> file- /home/charlie/sfproject/cache/frontend/dev/config/config_autoload.yml.php
charlie@mystery:~/sfproject$ php symfony doctrine:build-filters
>> doctrine generating filter form classes
PHP Fatal error: Class 'columns' not found in /home/charlie/sfproject/lib/model/doctrine/base/BasePost.class.php on line 25
Fatal error: Class 'columns' not found in /home/charlie/sfproject/lib/model/doctrine/base/BasePost.class.php on line 25
PHP Fatal error: Call to a member function evictAll() on a non-object in /home/charlie/sfproject/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 1239
Fatal error: Call to a member function evictAll() on a non-object in /home/charlie/sfproject/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 1239
charlie@mystery:~/sfproject$ php symfony doctrine:build-forms
>> doctrine generating form classes
PHP Fatal error: Class 'columns' not found in /home/charlie/sfproject/lib/model/doctrine/base/BasePost.class.php on line 25
Fatal error: Class 'columns' not found in /home/charlie/sfproject/lib/model/doctrine/base/BasePost.class.php on line 25
PHP Fatal error: Call to a member function evictAll() on a non-object in /home/charlie/sfproject/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 1239
Fatal error: Call to a member function evictAll() on a non-object in /home/charlie/sfproject/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 1239
charlie@mystery:~/sfproject$ php symfony cc
>> cache Clearing cache type "all" for "frontend" app and "test" env
>> file+ /home/charlie/sfproject/data/frontend_test-cli.lck
>> chmod 777 /home/charlie/sfproject/data/frontend_test-cli.lck
>> file- /home/charlie/sfproject/cache/frontend/test/config/config_config_handlers.yml.php
>> file- /home/charlie/sfproject/cache/frontend/test/config/config_app.yml.php
>> file- /home/charlie/sfproject/cache/frontend/test/config/config_settings.yml.php
>> file- /home/charlie/sfproject/data/frontend_test-cli.lck
>> cache Clearing cache type "all" for "frontend" app and "dev" env
>> file+ /home/charlie/sfproject/data/frontend_dev-cli.lck
>> chmod 777 /home/charlie/sfproject/data/frontend_dev-cli.lck
>> file- /home/charlie/sfproject/cache/frontend/dev/config/config_autoload.yml.php
>> file- /home/charlie/sfproject/cache/frontend/dev/config/config_config_handlers.yml.php
>> file- /home/charlie/sfproject/cache/frontend/dev/config/config_databases.yml.php
>> file- /home/charlie/sfproject/cache/frontend/dev/config/config_app.yml.php
>> file- /home/charlie/sfproject/cache/frontend/dev/config/config_settings.yml.php
>> file- /home/charlie/sfproject/data/frontend_dev-cli.lck
>> cache Clearing cache type "all" for "frontend" app and "prod" env
>> file+ /home/charlie/sfproject/data/frontend_prod-cli.lck
>> chmod 777 /home/charlie/sfproject/data/frontend_prod-cli.lck
>> file- /home/charlie/sfproject/cache/frontend/prod/config/config_config_handlers.yml.php
>> file- /home/charlie/sfproject/cache/frontend/prod/config/config_app.yml.php
>> file- /home/charlie/sfproject/cache/frontend/prod/config/config_settings.yml.php
>> file- /home/charlie/sfproject/data/frontend_prod-cli.lck
charlie@mystery:~/sfproject$