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

Base for a blog example #49

Merged
merged 57 commits into from Feb 16, 2020
Merged

Base for a blog example #49

merged 57 commits into from Feb 16, 2020

Conversation

roxblnfk
Copy link
Member

@roxblnfk roxblnfk commented Jan 29, 2020

Quick start

  1. Configure config/params.php (you can skip this step)
  2. Run composer install
  3. Run vendor/bin/yii serve or start your web-server
  4. Go to index page.
    On this step the Cycle ORM will create tables, indexes and relations automatically in the configured DB.
    If you want to disable this behavior then comment out line with Generator\SyncTables::class in the config/params.php file. In this case you should create migrations to sync changes of entities with DB
  5. Run vendor/bin/yii fixture/add 20 to create random data

Features:

  • Cycle ORM examples:
    • Entities with annotations
    • Repositories, Mappers and Constrains
  • Frontend:
    • Bootstrap 4 and his depended assets configured to CDN
    • Most popular tags panel
    • Archive panel
    • Pagination of posts
  • SQL queries logging in the terminal (if you use yii serve)

Todo:

  • add an admin panel and other publication abilities
  • use the OffsetPaginator from yiisoft/data package
  • yiisoft/widget integration
  • try entities with public fields instead of private with getters/setters (this should works faster)

image

# Conflicts:
#	resources/mail/layouts/html.php
# Conflicts:
#	composer.json
#	config/console.php
#	src/Entity/User.php
#	src/Factory/AppRouterFactory.php
#	src/globals.php
# Conflicts:
#	composer.json
#	config/common.php
#	src/Entity/User.php
#	src/Factory/AppRouterFactory.php
#	src/Repository/UserRepository.php
#	src/globals.php
# Conflicts:
#	config/params.php
#	src/Command/User/CreateCommand.php
@roxblnfk roxblnfk marked this pull request as ready for review February 9, 2020 14:41
@roxblnfk roxblnfk requested a review from samdark February 9, 2020 14:43
@yiiliveext
Copy link
Contributor

Classes should be grouped either by a type or by a layer.
Repository+Mapper+Scope together is OK. Repository+Mapper+Scope+Controller together is not OK.

Copy link
Contributor

@xepozz xepozz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, consider my comments also for similar classes (controllers, entities, repositories)

src/Blog/Archive/ArchiveRepository.php Outdated Show resolved Hide resolved
src/Blog/Archive/ArchiveRepository.php Outdated Show resolved Hide resolved
src/Blog/BlogController.php Show resolved Hide resolved
src/Blog/Archive/ArchiveRepository.php Outdated Show resolved Hide resolved
src/Blog/Archive/ArchiveRepository.php Show resolved Hide resolved
src/Entity/User.php Show resolved Hide resolved
src/Factory/AppRouterFactory.php Outdated Show resolved Hide resolved
src/Factory/AppRouterFactory.php Outdated Show resolved Hide resolved
src/Factory/AppRouterFactory.php Outdated Show resolved Hide resolved
src/Widget/OffsetPagination.php Outdated Show resolved Hide resolved
src/Factory/ViewFactory.php Show resolved Hide resolved
src/Entity/User.php Show resolved Hide resolved
@@ -19,6 +19,7 @@
"require": {
"php": "^7.4",
"cebe/markdown": "^1.2@dev",
"cycle/proxy-factory": "^1.2",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be required directly? Do we need it all the time? If so, does it make sense to move it to yii-cycle?

src/Blog/Archive/ArchiveController.php Outdated Show resolved Hide resolved
src/Blog/BlogController.php Outdated Show resolved Hide resolved
src/Blog/BlogController.php Outdated Show resolved Hide resolved
src/Blog/Entity/Comment.php Show resolved Hide resolved
views/blog/archive/index.php Outdated Show resolved Hide resolved
views/blog/post/index.php Outdated Show resolved Hide resolved
views/contact/form.php Outdated Show resolved Hide resolved
views/layout/main.php Outdated Show resolved Hide resolved
views/site/index.php Show resolved Hide resolved
src/Controller/UserController.php Outdated Show resolved Hide resolved
src/Controller/UserController.php Outdated Show resolved Hide resolved
@xepozz
Copy link
Contributor

xepozz commented Feb 14, 2020

Don't forget to make your controllers compatible. (#54 already in master)

@samdark
Copy link
Member

samdark commented Feb 14, 2020

@xepozz isn't it already done?

@xepozz
Copy link
Contributor

xepozz commented Feb 14, 2020

Oh, sorry. It's already complete :)

@roxblnfk
Copy link
Member Author

Found a strange behavior. On running ./vendor/bin/yii it outputs the following to the console:

...

As far as I understand it is re-reading schema. The questions are:

  1. Why it's done every time?
  2. Why it's done when I'm not doing anything DB-related?

Fixed in yiisoft/yii-cycle#23 and last commit

@samdark samdark merged commit 8faa802 into yiisoft:master Feb 16, 2020
@samdark
Copy link
Member

samdark commented Feb 16, 2020

Merged! Awesome job overall 👍 Let's continue with further fixes / enhancements separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:code review The pull request needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants