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

db seed error #67

Closed
zairl23 opened this issue May 8, 2015 · 3 comments
Closed

db seed error #67

zairl23 opened this issue May 8, 2015 · 3 comments
Labels

Comments

@zairl23
Copy link

zairl23 commented May 8, 2015

When i install flarum, i run 'php artisan flarum:seed', throw error below:

PHP Fatal error: Access to undeclared static property: Flarum\Core\Models\Post::$type in /vagrant/system/core/src/Core/Models/Post.php on line 61

well, change to :$post->type = $post::$types; on line61,

Go on running: 'php artisan flarum:seed, throw the error:

preg_replace(): Parameter mismatch, pattern is a string while replacement is an array ,

In the error logs:

[2015-05-08 06:28:39] local.ERROR: exception 'ErrorException' with message 'preg_replace(): Parameter mismatch, pattern is a string while replacement is an array' in /vagrant/system/vendor/laravel/framework/src/Illuminate/Support/helpers.php:703
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'preg_replace():...', '/vagrant/system...', 703, Array)
#1 /vagrant/system/vendor/laravel/framework/src/Illuminate/Support/helpers.php(703): preg_replace('/\\?/', Array, 'insert into `po...', 1)
#2 /vagrant/system/vendor/laravel/framework/src/Illuminate/Database/QueryException.php(55): str_replace_array('\\?', Array, 'insert into `po...')
#3 /vagrant/system/vendor/laravel/framework/src/Illuminate/Database/QueryException.php(37): Illuminate\Database\QueryException->formatMessage('insert into `po...', Array, Object(ErrorException))
#4 /vagrant/system/vendor/laravel/framework/src/Illuminate/Database/Connection.php(626): Illuminate\Database\QueryException->__construct('insert into `po...', Array, Object(ErrorException))
#5 /vagrant/system/vendor/laravel/framework/src/Illuminate/Database/Connection.php(580): Illuminate\Database\Connection->runQueryCallback('insert into `po...', Array, Object(Closure))
#6 /vagrant/system/vendor/laravel/framework/src/Illuminate/Database/Connection.php(363): Illuminate\Database\Connection->run('insert into `po...', Array, Object(Closure))
#7 /vagrant/system/vendor/laravel/framework/src/Illuminate/Database/Connection.php(320): Illuminate\Database\Connection->statement('insert into `po...', Array)
#8 /vagrant/system/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(30): Illuminate\Database\Connection->insert('insert into `po...', Array)
#9 /vagrant/system/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1718): Illuminate\Database\Query\Processors\Processor->processInsertGetId(Object(Illuminate\Database\Query\Builder), 'insert into `po...', Array, 'id')
#10 [internal function]: Illuminate\Database\Query\Builder->insertGetId(Array, 'id')
#11 /vagrant/system/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(933): call_user_func_array(Array, Array)
#12 /vagrant/system/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1609): Illuminate\Database\Eloquent\Builder->__call('insertGetId', Array)
#13 /vagrant/system/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1609): Illuminate\Database\Eloquent\Builder->insertGetId(Array, 'id')
#14 /vagrant/system/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1579): Illuminate\Database\Eloquent\Model->insertAndSetId(Object(Illuminate\Database\Eloquent\Builder), Array)
#15 /vagrant/system/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1485): Illuminate\Database\Eloquent\Model->performInsert(Object(Illuminate\Database\Eloquent\Builder), Array)
#16 /vagrant/system/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(529): Illuminate\Database\Eloquent\Model->save()
#17 /vagrant/system/core/src/Core/Seeders/DiscussionsTableSeeder.php(43): Illuminate\Database\Eloquent\Model::create(Array)
#18 /vagrant/system/vendor/laravel/framework/src/Illuminate/Database/Console/SeedCommand.php(57): Flarum\Core\Seeders\DiscussionsTableSeeder->run()
#19 [internal function]: Illuminate\Database\Console\SeedCommand->fire()
#20 /vagrant/system/vendor/laravel/framework/src/Illuminate/Container/Container.php(523): call_user_func_array(Array, Array)
#21 /vagrant/system/vendor/laravel/framework/src/Illuminate/Console/Command.php(115): Illuminate\Container\Container->call(Array)
#22 /vagrant/system/core/vendor/symfony/console/Command/Command.php(259): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /vagrant/system/vendor/laravel/framework/src/Illuminate/Console/Command.php(101): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /vagrant/system/vendor/laravel/framework/src/Illuminate/Console/Command.php(131): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /vagrant/system/core/src/Console/SeedCommand.php(46): Illuminate\Console\Command->call('db:seed', Array)
#26 [internal function]: Flarum\Console\SeedCommand->fire()
#27 /vagrant/system/vendor/laravel/framework/src/Illuminate/Container/Container.php(523): call_user_func_array(Array, Array)
#28 /vagrant/system/vendor/laravel/framework/src/Illuminate/Console/Command.php(115): Illuminate\Container\Container->call(Array)
#29 /vagrant/system/core/vendor/symfony/console/Command/Command.php(259): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 /vagrant/system/vendor/laravel/framework/src/Illuminate/Console/Command.php(101): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /vagrant/system/core/vendor/symfony/console/Application.php(878): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 /vagrant/system/core/vendor/symfony/console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Flarum\Console\SeedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 /vagrant/system/core/vendor/symfony/console/Application.php(126): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 /vagrant/system/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(94): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#35 /vagrant/system/artisan(11): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#36 {main}  

It's a sql insert error..

@zairl23
Copy link
Author

zairl23 commented May 8, 2015

i comment the line 61, run php artisan db:seed, error:

       [Illuminate\Database\QueryException]                                                                                                                                                                                           
       SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'api_url' for key 'PRIMARY' (SQL: insert into `config` (`key`, `value`) values (api_url, http://flarum.dev/api), (base_url, http://flarum.dev), (forum_  
      title, Flarum Demo Forum), (welcome_message, Flarum is now at a point where you can have basic conversations, so here is a little demo for you to break.), (welcome_title, Welcome to Flarum Demo Forum))                      

         [PDOException]                                                                                     
       SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'api_url' for key 'PRIMARY'

But the datas has been seeded, and the falrum can run success.:)!,

There are another some issues about config/app.php, must comment these lines:

             'Flarum\Core\CoreServiceProvider',
     // 'Flarum\Support\Extensions\ExtensionsServiceProvider',

    //'Flarum\Api\ApiServiceProvider',
    //'Flarum\Forum\ForumServiceProvider',
    'Flarum\Console\ConsoleServiceProvider',
    //'Flarum\Admin\AdminServiceProvider',

then run

     php artisan vendor:publish

     php artisan flarum:install

   php artisan flarum:seed

can setup the flarum success..

franzliedke added a commit that referenced this issue May 8, 2015
@franzliedke
Copy link
Contributor

This should be fixed now.

This one time, please destroy the Vagrant VM and re-clone the repository (while following the updated installation instructions at https://github.com/flarum/flarum#installation - please note the --recursive flag when cloning).

@zairl23
Copy link
Author

zairl23 commented May 9, 2015

Well, good solution, 3ks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants