Yii Framework Forum: Giiant - Gii On Steroids - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Giiant - Gii On Steroids CRUD Generator

#1 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 569
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 14 March 2014 - 01:44 PM

Hi,

I just added the provider feature from gtc (Yii 1) to giiant.

Quote


In many cases you want to exchange i.e. some inputs with a customized version for your project. Examples for this use-case are editors, file-uploads or choosers, complex input widget with a modal screen, getting data via AJAX and so on.

With Giiant Providers you can create a queue of instances which may provide custom code depending on more complex rules. Take a look at some existing giiant providers.

Have a look at: https://github.com/s...k42/yii2-giiant


Best regards,
schmunk
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#2 User is offline   pieturp 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 09-August 13

Posted 14 March 2014 - 04:18 PM

Unfortunately, I couldn't try it out :(

Installing it with

php composer.phar require schmunk42/giiant @dev


gave an error:

requirements could not be resolved to an installable set of packages.
  Problem 1
    - The requested package schmunk42/giiant could not be found in any version, there may be a typo in the package name.


Edit: Fixed it :)

php composer.phar require schmunk42/yii2-giiant @dev
instead of
php composer.phar require schmunk42/giiant @dev


Edit 2: No luck :(

You seem to have some conflicting ideas on namespacing :unsure:

I now get the following PHP error:
 PHP Fatal Error – yii\base\ErrorException	
Class 'schmunk42\giiant\Generator' not found


But trying to edit the configuration to use yii2-giiant also had no luck...

This post has been edited by pieturp: 14 March 2014 - 05:30 PM

0

#3 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 569
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 15 March 2014 - 09:33 AM

Thanks for your feedback, I fixed the README and updated master.
I was missing crud in the config here: schmunk42\giiant\crud\Generator


Please run


composer.phar update schmunk42/yii2-giiant


and let me know if it works now.
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#4 User is offline   pieturp 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 09-August 13

Posted 15 March 2014 - 11:00 AM

Yes. It works now :)

Looks very promising indeed. I'll check out more next week, as I'm planning to maybe write some custom providers of my own.
0

#5 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 569
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 15 March 2014 - 12:48 PM

Cool. For some inspiration about providers have a look at: https://github.com/s...lCrud/providers

I am looking forward about any feedback. I thought i.e. about using an interface or traits for providers, but found no real advantage so far.
Here's an example for a very app or project specific provider: https://gist.github....hmunk42/6641457
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#6 User is offline   pieturp 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 09-August 13

Posted 24 March 2014 - 11:36 AM

Hi Schmunk,

Unfortunately, I didn't have the time to dig in custom providers, but I now have another problem:

Apparently there has been a change in the way objects are configured; after an Yii update, I suddenly get the error "Fatal error: Access to undeclared static property: Yii::$objectConfig" in my web.php config file.

It is caused by
\Yii::$objectConfig = [
	    // giiant provider configuration
	    'schmunk42\giiant\crud\providers\EditorProvider' => [
	        'columnNames' => ['description']
	    ]
	];


I searched the docs for how this configuration should look now, but couldn't really find anything :(
0

#7 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 569
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 24 March 2014 - 12:36 PM

This is due to a Yii 2 API change, see here for how to update the app config:
https://github.com/p...ig/web.php#L100

Corresponding guide section: http://stuff.cebe.cc...ults-class-wide
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#8 User is offline   Jonny 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 184
  • Joined: 26-December 11

Posted 24 March 2014 - 12:44 PM

Does Giiant have the same facilities Giix does for creating base models so if you ever need to change your DB schema you can just re-run Gii and it wont overwrite your code in the models?
0

#9 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 569
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 24 March 2014 - 01:27 PM

I haven't implemented this yet, but yes it's planned.
Would be nice if you could create an issue for this: https://github.com/s...2-giiant/issues


We'd need a custom template and a generator for the model.
I'd suggest an additional attribute "createModel" which could be set to false (checkbox).

For the CRUDs I thought about a base class and almost empty controller classes, similar to this Yii 1 solution from Mike (https://github.com/m...xcrudcontroller). But this could also be handled with a custom template, so it's optional - and also one additional attribute for the generator "createController".


btw: I am working on Gii from the command line: https://github.com/y.../yii2/pull/2789 which also would fit nicely into your workflow, I guess.
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#10 User is offline   pieturp 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 09-August 13

Posted 24 March 2014 - 05:08 PM

View Postschmunk, on 24 March 2014 - 12:36 PM, said:

This is due to a Yii 2 API change, see here for how to update the app config:
https://github.com/p...ig/web.php#L100

Corresponding guide section: http://stuff.cebe.cc...ults-class-wide


Thanks a lot!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users