c33s/core-bundle

此包已被废弃且不再维护。未建议替代包。

一切用于快速启动网页

安装: 825

依赖: 0

建议者: 0

安全: 0

星标: 3

关注者: 4

分支: 2

开放问题: 0

语言:HTML

类型:symfony-bundle


README

一切用于快速启动网页

Build Status SemVer Latest Stable Version Latest Unstable Version License SensioLabsInsight Project Status

由于json格式不是一种方便阅读的格式,并且它还缺少注释支持,因此此Bundle支持composer.yml格式。《a href="https://github.com/igorw/composer-yaml" rel="nofollow noindex noopener external ugc">composer-yaml.phar用于将yml转换为json。在此手册中,所有composer代码片段均为yml格式。创建一个脚本文件,在运行composer之前调用yml到json转换器。确保您手头有composercomposer-yaml命令。

简短快速手册

您可以在空的项目目录内执行以下命令来完成整个安装过程

# Get sample composer file directly from github
wget https://raw.githubusercontent.com/c33s/CoreBundle/master/Resources/files/composer-example.yml -O composer.yml --no-check-certificate
# Modify composer.yml as needed. You may leave this for later.

# Create empty composer.json
touch composer.json

# Convert composer.yml to json format. Do this every time you modify your composer.yml
composer-yaml convert

# Update dependencies without running any scripts. This may take a while.
composer update --no-scripts

# In the following commands, replace "YourNamespace" with your default Namespace prefix you want to use for this project's bundles. Keep it short but helpful.
./bin/init-symfony run YourNamespace

# Now that the project structure is here it's time to run those fancy composer scripts
composer run-script post-update-cmd

# Init basic configuration
php app/console c33s:init-config YourNamespace

# Generate cms structure (webpage and admin bundles)
php app/console c33s:init-cms YourNamespace

# Optional: generate AdminGeneratorGenerator configuration that is automatically patched and correctly integrated into your project
php app/console admin:c33s:build YourNamespace

# This command will clear your cache and pre-render assets
php app/console c33s:clean

确保Web服务器权限设置正确。这包括媒体上传路径以及默认使用的sqlite数据库。更多信息请参阅https://symfony.com.cn/doc/master/book/installation.html#configuration-and-setup

您应该启用以下文件夹的Web服务器写入权限

app/cache
app/logs
app/data
web/media

如果一切顺利,您在访问/admin/时应该会看到一些示例页面以及安全的管理员登录界面。

功能

Propel模型特性

一个辅助特性,可用于扩展您的propel模型类,以便轻松加载数据(用于1:n关系)从您的 fixtures。数据可以直接定义在关联对象的 fixture 文件中。

通过以下方式扩展您的类

ACME/ModelBundle/YourPropelObject.php

class YourPropelObject extends BaseYourPropelObject
{
    use \c33s\ModelBundle\Traits\PropelModelTraits;

    public function setYourDataFromArray($data)
    {
	$properties = array
	(
	    'model' => 'ACME\\ModelBundle\\Model\\YourExtraModel',
	);

	return $this->setRelationFromDataArray($data, $properties);
    }

您可以定义如下 fixtures

app/propel/fixtures/yourfixtures.yml

ACME\ModelBundle\Model\YourPropelObject:
    YourPropelObject_1:
	 	# normal m:n relation fixtures
        object_has_groups:
            - Group_1
            - Group_2
     	# load 
        your_data_from_array:
            - name: your data name1
              type:  type1
            - value: your data name2
              type:  type2