Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
oil generate model generates empty migrations
  • I have done that command from docs, but it works wrong. Why does it happen ?
    (11:50)[azhuravlov@laptop: ~/Projects/fueltest]# oil g model post title:varchar[50] body:text user_id:int
    Warning - end() expects parameter 1 to be array, boolean given in PKGPATH/oil/classes/generate.php on line 359
    Warning - end() expects parameter 1 to be array, boolean given in PKGPATH/oil/classes/generate.php on line 698
            Creating model: /home/azhuravlov/Projects/fueltest/fuel/app/classes/model/post.php
            Creating migration: /home/azhuravlov/Projects/fueltest/fuel/app/migrations/001__2.php
    
    (11:52)[azhuravlov@laptop: ~/Projects/fueltest]# cat ./fuel/app/classes/model/post.php 
    <?php
    
    class Model_Post extends \Orm\Model
    {
            protected static $_properties = array(
                    'id',
                    'title',
                    'body',
                    'user_id',
                    'created_at',
                    'updated_at'
            );
    
            protected static $_observers = array(
                    'Orm\Observer_CreatedAt' => array(
                            'events' => array('before_insert'),
                            'mysql_timestamp' => false,
                    ),
                    'Orm\Observer_UpdatedAt' => array(
                            'events' => array('before_save'),
                            'mysql_timestamp' => false,
                    ),
            );
    }
    
    (11:59)[azhuravlov@laptop: ~/Projects/fueltest]# cat ./fuel/app/migrations/001__2.php 
    <?php
    
    namespace Fuel\Migrations;
    
    class _2
    {
            public function up()
            {
    
            }
    
            public function down()
            {
    
            }
    
  • I think you are using the 1.1 release, correct? Quite a few bug were fixed after that, perhaps you should switch to 1.1/develop if you don't want to wait for the 1.2 release.
  • Sample with older php version works fine
    (09:14)[azhuravlov@deka: ~/fueltest]# php -v
    PHP 5.3.3 (cli) (built: Feb  2 2012 23:24:47) 
    Copyright (c) 1997-2010 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    
    (09:14)[azhuravlov@deka: ~/fueltest]# oil g model post title:varchar[50] body:text user_id:int
            Creating model: /home/azhuravlov/fueltest/fuel/app/classes/model/post.php
            Creating migration: /home/azhuravlov/fueltest/fuel/app/migrations/001_create_posts.php
    
    (09:16)[azhuravlov@deka: ~/fueltest]# cat ./fuel/app/migrations/001_create_posts.php 
    <?php
    
    namespace Fuel\Migrations;
    
    class Create_posts
    {
            public function up()
            {
                    \DBUtil::create_table('posts', array(
                            'id' => array('constraint' => 11, 'type' => 'int', 'auto_increment' => true),
                            'title' => array('constraint' => 50, 'type' => 'varchar'),
                            'body' => array('type' => 'text'),
                            'user_id' => array('constraint' => 11, 'type' => 'int'),
                            'created_at' => array('constraint' => 11, 'type' => 'int'),
                            'updated_at' => array('constraint' => 11, 'type' => 'int'),
                    ), array('id'));
            }
    
            public function down()
            {
                    \DBUtil::drop_table('posts');
            }
    } 
    
    I guess problem hides in php version because next sample fails with newest php version
    (09:23)[azhuravlov@laptop: /home/htdocs/fueltest]# php -v
    PHP 5.3.10 with Suhosin-Patch (cli) (built: Feb  6 2012 19:22:23) 
    Copyright (c) 1997-2012 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    
    (09:23)[azhuravlov@laptop: /home/htdocs/fueltest]# oil g model post title:varchar[50] body:text user_id:int
    Warning - end() expects parameter 1 to be array, boolean given in PKGPATH/oil/classes/generate.php on line 359
    Warning - end() expects parameter 1 to be array, boolean given in PKGPATH/oil/classes/generate.php on line 698
            Creating model: /home/htdocs/fueltest/fuel/app/classes/model/post.php
            Creating migration: /home/htdocs/fueltest/fuel/app/migrations/001__2.php
    
    (09:25)[azhuravlov@laptop: /home/htdocs/fueltest]# cat ./fuel/app/migrations/001__2.php 
    <?php
    
    namespace Fuel\Migrations;
    
    class _2
    {
            public function up()
            {
    
            }
    
            public function down()
            {
    
            }
    
  • I have recompiled php-5.3.10 without Suhosin-Patch, and after that models are generating normally

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion