Git Product home page Git Product logo

oil's Introduction

FuelPHP

Description

FuelPHP is a fast, lightweight PHP 5.4+ framework. In an age where frameworks are a dime a dozen, we believe that FuelPHP will stand out in the crowd. It will do this by combining all the things you love about the great frameworks out there, while getting rid of the bad.

FuelPHP is fully PHP 7.3 compatible.

More information

For more detailed information, see the development wiki.

Development Team

Want to join?

The FuelPHP development team is always looking for new team members, who are willing to help lift the framework to the next level, and have the commitment to not only produce awesome code, but also great documentation, and support to our users.

You can not apply for membership. Start by sending in pull-requests, work on outstanding feature requests or bugs, and become active in the #fuelphp IRC channel. If your skills are up to scratch, we will notice you, and will ask you to become a team member.

Alumni

oil's People

Contributors

aranw avatar crynobone avatar dbpolito avatar dhrrgn avatar dongilbert avatar dregondrahl avatar frankdejonge avatar fuel-packages avatar huglester avatar kenjis avatar m0nocle avatar mamor avatar maximebeaudoin avatar okhayat avatar purwandi avatar qchmqs avatar rob-mccann avatar ryurock avatar sagikazarmark avatar sahanh avatar samuelsmal avatar sdrdis avatar stevewest avatar takyam-git avatar tarnfeld avatar teeedwards avatar wanwizard avatar watilde avatar zbrox avatar zerojarvis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oil's Issues

Exceptions in tasks

Exceptions in tasks seem to be a little sporadic. For example, I have this line:

$domain->metaphones[] = Model_Metaphone::find_or_create(array('metaphone'=>metaphone($word)));

The assignment was failing because I typoed the related model. This is throwing an exception which can be caught in a try/catch block however, until I did a bunch of die()s to work out where the error line was and surrounded it in a try/catch block with a print of the exception, it failed to notify me of the error.

migrate:down sets version to 0 in migration table

Migrate:down sets the version field to 0 in migration table but displays on console that it is one version lower.

eg:

On version 4 and then ran oil refine migrate:down

displays:
Migrated to version: 3 for app:default.

When i creating controller using oil i have some error

Purwandis-MacBook-Pro:fuel purwandi$ php oil g controller user index login logout
Warning - file_get_contents(/Volumes/Storage/www/fuel/lib/fuel/packages/oil/views/default/template.php): failed to open stream: No such file or directory in PKGPATH/oil/classes/generate.php on line 275
Creating view: /Volumes/Storage/www/fuel/app/views/template.php
Creating view: /Volumes/Storage/www/fuel/app/views/user/index.php
Creating view: /Volumes/Storage/www/fuel/app/views/user/login.php
Creating view: /Volumes/Storage/www/fuel/app/views/user/logout.php
Creating controller: /Volumes/Storage/www/fuel/app/classes/controller/user.php

After scaffold wrong model filename

Hi there!

I just wrote that command (the problem is repeatable):
$~: oil g scaffold users firstname:string lastname:string username:string password:char[45] active:tinyint[1]
Creating model: /var/www/html/fuelLearn/fuel/app/classes/model/users.php
Creating migration: /var/www/html/fuelLearn/fuel/app/migrations/001_create_users.php
Creating controller: /var/www/html/fuelLearn/fuel/app/classes/controller/users.php
Creating view: /var/www/html/fuelLearn/fuel/app/views/users/index.php
Creating view: /var/www/html/fuelLearn/fuel/app/views/users/view.php
Creating view: /var/www/html/fuelLearn/fuel/app/views/users/create.php
Creating view: /var/www/html/fuelLearn/fuel/app/views/users/edit.php
Creating view: /var/www/html/fuelLearn/fuel/app/views/users/_form.php
Creating view: /var/www/html/fuelLearn/fuel/app/views/template.php

$~: oil r migrate

After that the system can't find the Model_User class, probably becaouse of the wrong model name.

Generate Scaffold based on Database

Would be great if we have a way to generate scaffold based on created database tables instead of create it all from oil then we can use a DB Design Tool.

oil g scaffold users --from-table (get the fields on users table and generate the files)

Does it make sense for someone else?

Oil generate scaffolding with orm option generating model_crud code in controller

Each time I create a new scaffolding using the orm option I seem to get a call to the model in my controller looking like

Company::find_all();

And this throws an error

Fuel\Core\Database_Exception [ Error ]: SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.' in 'where clause' with query: "SELECT `t0`.`id` AS `t0_c0`, `t0`.`name` AS `t0_c1`, `t0`.`phone` AS `t0_c2`, `t0`.`address` AS `t0_c3`, `t0`.`postcode` AS `t0_c4`, `t0`.`email` AS `t0_c5`, `t0`.`created_at` AS `t0_c6`, `t0`.`updated_at` AS `t0_c7` FROM `companies` AS `t0` WHERE `t0`.`id` = '0' OR ((`t0`.`` IS NULL)) LIMIT 1"

When I change this to

Company::find('all');

That error no longer exist.

"oil g scaffold ... --orm" creates models extending Model_Crud, not ORM

I'm using Fuelphp 1.1dev branch.

When oil creates a model with the "--orm" switch, the model is created referencing Model\orm as expected.

When oil generates a model as part of the "scaffold" process, the "--orm" switch is ignored, and resultant models will reference Model_Crud instead. This occurs even if the model has already been successfully created referencing Model\orm prior to the scaffolding command.

E.g.
oil g model foo title:varchar[50] body:text user_id:int --orm

generates a "foo" model using Model\orm as expected.

Then running:
php oil g scaffold --orm foo title:varchar[50] body:text user_id:int

throws the expected error:
Error: /..PATH.../fuel/app/classes/model/foo.php already exists, use -f or --force to override.

Forcing the override just overwrites the ORM model with a CRUD model

Reference in forums:
http://fuelphp.com/forums/topics/view/6082#6478

Problems with ErrorException, can't avoid an error in Oil Refine

I have latest 1.1/develop version.
I think there is something wrong with error exception in oil.
This code for example:

try{
    $handle = @fopen('http://bad.location', "rb");
}
catch(Exception $e)
{

}

There is no way i can avoid errors and continue my script. On every error fopen throws scripts exits.
Are there any workarounds?

This same scripts works perfectly in usual environment, but runing Oil refine always produces errors you cannot handle or avoid and script exits.

I think there should be a way to display errors and notices, but to avoid exiting the script, now it always exists on smallest notice or warning.

Thanks

Option to make scaffolding non-plural

Currently the scaffolding makes the model name plural for migration, controller and views.

E.g.

$ php oil g scaffold monkey name:string description:text
Created model: APPPATH/classes/model/monkey.php
Created migration: APPPATH/migrations/003_create_monkeys.php
Created controller: APPPATH/classes/controller/monkeys.php
Created view: APPPATH/views/monkeys/index.php
Created view: APPPATH/views/monkeys/view.php
Created view: APPPATH/views/monkeys/create.php
Created view: APPPATH/views/monkeys/edit.php
Created view: APPPATH/views/monkeys/_form.php

Could we have a option to make it non-plural.

E.g.

$ php oil g scaffold monkey name:string description:text
Created model: APPPATH/classes/model/monkey.php
Created migration: APPPATH/migrations/003_create_monkey.php
Created controller: APPPATH/classes/controller/monkey.php
Created view: APPPATH/views/monkey/index.php
Created view: APPPATH/views/monkey/view.php
Created view: APPPATH/views/monkey/create.php
Created view: APPPATH/views/monkey/edit.php
Created view: APPPATH/views/monkey/_form.php

oil g controller creates singular file and controller names

Using FuelPHP v1.0 Final

When using oil g controller to create a new controller it creates the singular version of the filename and the classname rather than the pluralized one.

Example:
php oil g controller url

Creates:
app/classes/controller/url.php -> class Controller_Url extends ...

Rather than
app/classes/controller/urls.php -> class Controller_Urls extends ...

Relevant lines are in packages/oil/classes/generate/generate.php

44: $filename = trim(str_replace(array('_', '-'), DS, $singular), DS);
52: array_unshift($args, $singular);

created_at and updated_at standards

According to what I've seen from the migration files created by oil when running the scaffold command, the standard for created_at and updated_at fields are that of signed int for storing unix timestamps.

The issue I can see with this is that the maximum a MySQL database can store in an signed int is 2147483647 - which equals Tue, 19 Jan 2038 03:14:07 GMT. While this is indeed many years in the future, would it not be better to have the default set at unsigned int, allowing for a value of 4294967295 - or Sun, 07 Feb 2106 06:28:15 GMT, or even bigint (either signed or unsigned), for even further dates into the future?

Migration generator will overwrite created_at and updated_at fields

When going through the documentation I ran "php oil g model post title:varchar[50] body:text user_id:int created_at:datetime". The generated migration is:

<?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('type' => 'datetime'),
            'created_at' => array('constraint' => 11, 'type' => 'int'),
            'updated_at' => array('constraint' => 11, 'type' => 'int'),
        ), array('id'));
    }

    public function down()
    {
        \DBUtil::drop_table('posts');
    }
}

As you can see, 'created_at' is declared twice, the second time overwriting the user's command line declaration. This diff fixes the bug in this specific instance. Sorry if this has already been reported - I couldn't find it.

index 97befc2..5cca87e 100644
--- a/classes/generate/migration/actions.php
+++ b/classes/generate/migration/actions.php
@@ -32,7 +32,8 @@ class Generate_Migration_Actions
        public static function create($subjects, $fields)
        {
                $field_str = '';
+               $defined_columns = array();
+
                foreach($fields as $field)
                {
                        $name = array_shift($field);
@@ -58,7 +59,8 @@ class Generate_Migration_Actions
                        }
                        $field_opts = implode(', ', $field_opts);

-                       $field_str .= "\t\t\t'$name' => array({$field_opts}),".PHP_EOL;                 
+                       $field_str .= "\t\t\t'$name' => array({$field_opts}),".PHP_EOL;
+                       $defined_columns[$name] = true;
                }

                // ID Field
@@ -66,8 +68,16 @@ class Generate_Migration_Actions

                if ( ! \Cli::option('no-timestamps', false))
                {
-                       $field_str .= "\t\t\t'created_at' => array('constraint' => 11, 'type' => 'int'),";
-                       $field_str .= PHP_EOL."\t\t\t'updated_at' => array('constraint' => 11, 'type' => 'int'),";
+                       if ( ! isset($defined_columns['created_at']))
+                       {
+                               $field_str .= "\t\t\t'created_at' => array('constraint' => 11, 'type' => 'int'),".PHP_EOL;
+                       }
+
+                       if ( ! isset($definied_columns['updated_at']))
+                       {
+                               $field_str .= "\t\t\t'updated_at' => array('constraint' => 11, 'type' => 'int'),";
+                       }
+
                }

                $up = <<<UP

Syntax error in _form.php on line 6 when using scaffold

fuel/packages/oil/views/default/scaffold/views/_form.php

Looks like theres a missing closing ) on line 6:

--- _form.php
+++ (clipboard)
@@ -3,7 +3,7 @@

<p>
    <?php
  •       echo "<?php echo Form::label('". \Inflector::humanize($field['name'] ."', '{$field['name']}'); ?>\n";
    
  •       echo "<?php echo Form::label('". \Inflector::humanize($field['name']) ."', '{$field['name']}'); ?>\n";
    
        switch($field['type']):
    

Created_at and Updated_at Missing

I've ran this oil g scaffold message user_id:int message:text and i'm getting Unknown Column to created_at and updated_at, i saw on the migrations generated and there haven't these fields.

I think it's related to commit from @FrenkyNet 3fe7f07

oil refine robots stops working after changing the app dir path

oil refine robots works fine but when you take the app directory out of "fuel" it gives this error:

PHP Warning: require(/bootstrap.php): failed to open stream: No such file or directory in /Users/username/Sites/project/oil on line 33

Warning: require(/bootstrap.php): failed to open stream: No such file or directory in /Users/username/Sites/project/oil on line 33
PHP Fatal error: require(): Failed opening required '/bootstrap.php' (include_path='.:') in /Users/username/Sites/project/oil on line 33

Fatal error: require(): Failed opening required '/bootstrap.php' (include_path='.:') in /Users/username/Sites/project/oil on line 33

Scaffolding creates invalid controller name

Hey, this is my first issue opened ever, so please don’t kill me if I’m doing something wrong :)

The problem I encountered is connected with scaffolding. When I type something like this:
oil g scaffold animal name:string type:text

Oil creates controller file named animals.php, but puts class Controller_Animal extends Controller_Template. The name of the file and inside the file are different and it causes some problems. I have to correct it by hand to get it working.

--no-timestamp Still Creates Fields in Migration

Using the "--no-timestamp'' option for generating models (and for scaffolding) still generates 'created_at' and 'updated_at' fields in the migration file. To reproduce:

oil g model monkey name:string description:string --orm --no-timestamp

The model file is produced correctly, without the time observers.

The migration file, however, contains:

<?php

namespace Fuel\Migrations;

class Create_monkeys {

    public function up()
    {
        \DBUtil::create_table('monkeys', array(
            'id' => array('constraint' => 11, 'type' => 'int', 'auto_increment' => true),
            'name' => array('constraint' => 255, 'type' => 'varchar'),
            'description' => array('constraint' => 255, 'type' => 'varchar'),
            'created_at' => array('constraint' => 11, 'type' => 'int'),
            'updated_at' => array('constraint' => 11, 'type' => 'int'),
        ), array('id'));
    }

    public function down()
    {
        \DBUtil::drop_table('monkeys');
    }
}

It seems that the 'created_at' and 'updated_at' fields are still being included. This happens also when scaffolding.

Inexistent "rename_field" Magic Migration

The documentation mentions the existence of the following 'magic migration':

$ php oil generate migration rename_field_name_to_username

There does not seem to be any further documentation, and no example of how this is supposed to work - ie., if I have 2 tables with the same field name, how is the migration going to know which field (from which table) I'm trying to rename?

I have tried using the command, but only get errors:

knud$ oil g migration rename_field_salary1_to_salary999
Error - Database method Fuel\Core\Database_PDO_Connection::list_columns is not supported by
Fuel\Core\Database_PDO_Connection in COREPATH/classes/database/pdo/connection.php on line 191

template.php location

Hello,

first of all, thanks for a great framework

now this is my issue

when I issue the command
php oil g scaffold [model] [fields..n]

the above will create [model] including a template.php which is found in view

but question is
can we possibly move template.php to [model]/template.php?

my reason is, what if i want to generate or create all my models?

hope this is clear to all,,,

thanks

DOCROOT constant doesn't point to the same location as public/index.php

You rejoined the room.
[11:36am] crynobone: WanWizard: got a minute?
[12:10pm] WanWizard: crynobone: whats up?
[12:11pm] crynobone: is there any reason why DOCROOT in oil and public/index.php doesn't point to the same folder
[12:11pm] WanWizard: don't know
[12:11pm] crynobone: can we make it the same?
[12:12pm] WanWizard: in both cases it points to the directory the script is in. don't know what happens if you change it
[12:12pm] WanWizard: try it out
[12:13pm] crynobone: yeah
[12:13pm] crynobone: or should we add another constant
[12:13pm] crynobone: ie WEBROOT?
[12:14pm] crynobone: it would be easier if for instance oil want to lookup file in assets folder, or other related stuff
[12:16pm] crynobone: had a scenario where i need it before, but forgotten
[12:19pm] WanWizard: crynobone: DOCROOT is used only once in oil, for loading phpunit. that might be done differently, in which case it would be save to alter DOCROOT
[12:19pm] WanWizard: create an issue for it so Phil can have a look
[12:19pm] crynobone: ok

This introduce an inconsistent result when running from oil (cli) and public/index.php (web) when you try to include custom feature.

Scenario

In my case, I was trying to use a simplified config.php file inside public/ folder for db configuration (this would be useful to create a web-app style deployment).

<?php

// Load in the Autoloader
require COREPATH.'classes'.DIRECTORY_SEPARATOR.'autoloader.php';
class_alias('Fuel\\Core\\Autoloader', 'Autoloader');

// Bootstrap the framework DO NOT edit this
require COREPATH.'bootstrap.php';


Autoloader::add_classes(array(
    // Add classes you want to override here
    // Example: 'View' => APPPATH.'classes/view.php',
    'Controller' => APPPATH.'classes/controller.php',
));

// Register the autoloader
Autoloader::register();

if ( ! is_file(DOCROOT.'config.php'))
{
    throw new \HttpNotFoundException();
}
else
{
    include DOCROOT.'config.php';
}

Excepted Behavior

Running from web and cli would work without any problem.

Actual Result

oil failed to run anything because DOCROOT return different path.

Add mongo template for scaffolding

With mongo in the core it would be sweet to make a different template for scaffolding to generate mongo-based MVC components in the same way as ORM stuff is currently done.

Adding more PHPUnit options to oil

I actually just forked oil to work on this, but I thought I'd post about it here and see what the consensus is.

My desire to do this came from wanting to use the exclude-group option in PHPUnit in a site I'm working on, so I put it in oil. But there's more useful options in PHPUnit that don't get passed in Oil, and a help menu that explains them all. Oil should have at least some of these extra options.

oil template.php no such a file or directory

may be somebody already submitted this issue i found today even with fresh installation of fuel while generating controller. on my machine

Warning - file_get_contents(/Applications/XAMPP/xamppfiles/htdocs/company/fuel/packages/oil/views/crud/template.php): failed to open stream: No such file or directory in PKGPATH/oil/classes/generate.php on line 321

there is no crud directory under view in oil package.

Controller class names always become singular

Whenever I generate a controller via Oil that has a plural name, the actual class name ends up using the singular version.

For example, if I type php oil g controller users index login logout the class name will end up being Controller_User (instead of Controller_Users), which will causes an error when trying to load the controller.

After digging around, it seems like the culprit is $class_name = \Inflector::classify($plural); which actually singularizes the name in the classify function.

One solution (not sure if it's the best one) would be to add a second parameter to the classify function, like so:

public static function classify($table_name, $force_singular = true)
{
    return preg_replace('/(^|_)(.)/e', "strtoupper('\\1\\2')", ($force_singular) ? static::singularize($table_name) : $table_name);
}

Then the Oil function could be called like:

$class_name = \Inflector::classify($plural, false);

Magic Migration "rename_table" - Allow prefixes_ & longer_table_names [Feature]

Hi,

The following don't work with magic migration, what if you need to rename tables with long names/prefixes and vice versa.

php oil generate migration rename_table_users_to_prefix_users
php oil generate migration rename_table_prefix_users_to_users
php oil generate migration rename_table_users_to_users_table_with_long_name
php oil generate migration rename_table_users_table_with_long_name_to_users_table_with_much_longer_name

Presently if you try the migration looks like this:

namespace Fuel\Migrations;

class Rename_table_users_to_prefix_users
{
        public function up()
        {
                \DBUtil::rename_table('', '');
        }

        public function down()
        {
                \DBUtil::rename_table('', '');
        }
}   

Please could we add this feature, it would make it easier to handle migrations when working with tables that belong to other applications like drupal, wordpress, magneto etc.

Keep up the great work!

Thanks

Can't install oil on Ubuntu Natty

Followed the instructions posted on the site.
$ curl get.fuelphp.com/oil | sh

When I try to create a new project I get the following:

$ oil create project
/usr/bin/oil: line 8: git: command not found
Could not open input file: ./project/oil

And if I run:
$oil
I get:
This is not a valid Fuel installation so Oil is a bit lost.
http://fuelphp.com/docs/installation/instructions.html

Didn't find any documentation about it.... What am I doing wrong?

oil Scaffolding with Foreign Keys

Let's say we have 2 tables, linked with a Foreign Key.

CREATE TABLE cities ( id int(11) NOT NULL AUTO_INCREMENT, name varchar(255) NOT NULL, created_at int(11) NOT NULL, updated_at int(11) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB;

CREATE TABLE users ( id int(11) NOT NULL AUTO_INCREMENT, name varchar(255) NOT NULL, city_id int(11) NOT NULL, created_at int(11) NOT NULL, updated_at int(11) NOT NULL, PRIMARY KEY (id), CONSTRAINT users_ibfk_0 FOREIGN KEY (city_id) REFERENCES cities (id) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB;

Issues:

  1. How can I specify to oil (on generate) that city_id should be a Foreign Key ?
  2. For tables with FK, oil should generate controllers with _has_one / _belongs_to, according to foreign keys.
  3. When views are created for 'users', the view should display, by default, City Name (from cities) instead of city_id.
  4. When _form is created for editing 'users', the form should generate a Form::select for city_id, with values taken from cities (Name).

I have opened a forum post for this: http://fuelphp.com/forums/topics/view/4315

Regards,
/Sorin

Validation Class Crashes Console

Issue reported in the Forum (http://fuelphp.com/forums/topics/view/5199).

It seems that Validation objects can be instantiated in the console, but not used - from the command line:

> oil console
Fuel 1.0.1 - PHP 5.3.6 (cli) (Jun 16 2011 22:23:58) [Darwin]

>>> $val = Validation::factory()
>>> $val->add_field('username', 'Your username', 'required')
PHP Fatal error: Nesting level too deep - recursive dependency? in /Users/[...]/fuel/packages/oil/classes/console.php on line 111
Error - Nesting level too deep - recursive dependency? in PKGPATH/oil/classes/console.php on line 111

Creating $val is possible, but trying to add fields or rules (and test validation) seems to cause a crashing recursion error.

automagic oil refine migrate

by using just oil refine migrate on my machine, migrate was matching the $version === $current version which of course it should not. Maybe this is something weird with my system? but it was not letting me automagically update to the newest version.

I added in a small fix that seems to be working great.

changed:
line #44 of /fuel/app/core/tasks/migrate.php
else if ($version == $current_version)

To:
else if (!is_null($version) && $version == $current_version)

Oil not working under cPanel cron

The Oil package not working under cPanel cron jobs.

It throws an exception:

ErrorException [ Error ]: Class 'Fuel\Core\Exception' not found

The exception it want to throw:
Cli class cannot be used outside of the command line.

I edited the oil package and removed any lines that contains anything abot Cli class, and now it works under cPanel.

I think cPanel runs cron jobs another way or I don't know the problem, but it is not working under cPanel.

Adding fields to existing tables does not work as expected.

I tried this:
oil generate migration add_field_with_underscore_to_table field_with_underscore:type[size]

This generates the migration code:

<?php

namespace Fuel\Migrations;

class Add_field_with_underscore_to_table {

    public function up()
    {
    \DBUtil::add_fields('field_with_underscore_to_table', array(
                        'field_with_underscore' => array('constraint' => 0, 'type' => 'type'),

    )); 
    }

    public function down()
    {
    \DBUtil::drop_fields('field_with_underscore_to_table', array(
            'field_with_underscore'    
    ));
    }
}

But this works:

oil generate migration add_table field_with_underscore:[type]

But this produces nonsensical migration names.

It should ignore everything between add_ and table in add_field_with_underscore_to_table, while generating the code.

Right now it doesn't.

Migration Unable to Set Precision in DECIMAL Fields

When specifying fields of type DECIMAL or FLOAT, it is usually needed to pass 2 integers as constraints, in the format "M,P", where "M" sets the total number of digits to be stored in the column ("magnitude"), and "P" specifies how many out of those digits will be used for the decimal part of the number ("precision"). Therefore, a DECIMAL columns with constrains "6,2" would store numbers made up of 6 digits, where 2 of these are used for the decimal part - such as: "1234.56" or "9876.54." If a column of type DECIMAL is specified with no precision, it is assumed to have precision '0' - that is, to have no decimal part at all.

Currently, it seems that there is no way to specify a DECIMAL (or FLOAT) field appropriately, if created using oil.

What would be required is something like:

oil generate migration add_salary_to_employees salary:decimal[6,2]

Migration drop table can't treat unique key properly

I generated migration create table, and added to up() function in the migration file:

\DBUtil::create_index('users', array('username', 'email'), '', 'UNIQUE');

And I executed "oil r migrate".

And I generated migration drop table. The migration file's down() function is like below:

\DB::query("CREATE INDEX username_idx ON cf_users (`username`)")->execute();

This is because the down() function is created with \DB::list_columns() which does not give full index information of the table.

oil singularizes class names

oil g controller images action1 action2 command creates a controller called Controller_Image not Controller_Images therefore /image/action1 nor images/action1 work because the controller filename is images.

generate controller shows warning

$ php oil g controller form action1 action2

Warning - file_get_contents(...fuel/packages/oil/views/crud/template.php): failed to open stream: No such file or directory in PKGPATH/oil/classes/generate.php on line 321

Generate an empty controller

I ran the command like this: "php oil g controller" and it generated an empty name controller, only ".php" a an index view in /view folder. I should get a warning or something

Oil Create "App" clones 1.1/develop

I'm not sure where to report this, so I'll start here. I created a few apps earlier this week (before the fuelphp branch name changes), and when I would run "oil create myApp" it would be using the master branch. This afternoon it seems that "oil create myApp" clones 1.1/develop. Shouldn't this default to the latest, released & stable branch?

oil singularizes class names

oil g controller images action1 action2 command creates a controller called Controller_Image not Controller_Images therefore /image/action1 nor images/action1 work because the controller filename is images.

Feature Request: New Magic Migration "set_unique"

FuelPHP already has excellent tools that help us implement data validation and integrity checks in at the Model level - as it should be! Nevertheless, many programmers have to specify data integrity constraints also at database level. In my case, for instance, this is a requirement at my workplace that I cannot get around.

It would be wonderful if a new 'magic migration' could be added to oil's already fantastic set, that would enable me to simply call:

oil g migration set_unique_email_in_users

The format for the call, obviously, is: set_unique_{fieldname}_in_{table name}. It seems to me that using the word 'set' is clearer than using, let's say, the word 'add', which makes it more ambiguous (makes it seem as if we're adding a field, rather than modifying an existing one).

This call would create a migration file with the following template:

<?php

namespace Fuel\Migrations;

class Set_unique_{fieldname}_in_{tablename} {

 public function up()
 {  
  //Adding UNIQUE constraint to '{fieldname}' column
  \DB::query("ALTER TABLE `{tablename}` ADD CONSTRAINT `uk_{fieldname}` UNIQUE (`{fieldname}`)")->execute();
 }

 public function down()
 {
  //Removing UNIQUE constraint from '{fieldname}' column
  \DB::query("ALTER TABLE `{tablename}` DROP INDEX `uk_{fieldname}`")->execute();
 }
}

Thank you for your consideration, and for all your great work with oil.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.