Skip to content
This repository has been archived by the owner on May 11, 2018. It is now read-only.

Latest commit

 

History

History
43 lines (33 loc) · 938 Bytes

03-create-new-content.md

File metadata and controls

43 lines (33 loc) · 938 Bytes

Example 03

Create new content
$ ezpublish/console ezpublish:migrations:generate
Generated new migration class to "/var/www/ezpublish/EzPublishMigrations/Version20150610145137.php"
// ezpublish/EzPublishMigrations/Version20150610145137.php
<?php
namespace Application\Migrations;

use Kreait\EzPublish\MigrationsBundle\Migrations\AbstractMigration as EzPublishMigration;
use Doctrine\DBAL\Schema\Schema;

class Version20150610145137 extends EzPublishMigration
{
    /**
     * @param Schema $schema
     */
    public function up(Schema $schema)
    {
        $this->createContent(2, 'folder', 'eng-GB', [
            'name' => 'This is a new folder',
            'short_name' => 'New folder'
        ]);

        $this->addSql(sprintf("SELECT \"Created new Folder group '%s'\"", 'New folder'));
    }

    /**
     * @param Schema $schema
     */
    public function down(Schema $schema)
    {

    }
}