Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
A couple of suggestions/observations/bugs
  • I'm still relatively new to fuelphp even though I've used it for a few months. Here are some of my observations:

    Upload class config file groups
    Having multiple groups for config file is rather important, rather than having to declare multiple $uploadconfig = array(); across controllers.

    Being able to declare multiple groups then call Upload::process('product-photos') would be rather handy.

    ORM related - how does cascade delete work?

    The docs do not explain clearly how cascade delete works. Does it delete both ways?

    For example, 

    Product:
    • has one featured product photo
    • has many product photo groups
    • each product photo group has many product photos
    • each product photo has many revisions (aka edit/crop)

    If cascade delete is enabled, every removal of each photo revision will eventually end up deleting the product.

    What if we just want a one-way cascading delete, whereby only the parent is removed should its children be removed?

    Currently my controller is running a ton of loops and model calls to check for this behavior.




    ORM related - Observers are very tricky and hard to understand

    Again the docs could be used to better explain how to extend Observers correctly.

    Here's an example of what I want to do:

    Product Photo:

    • before deleting this photo from db, check if file exists
    • if file does not exist, just proceed delete from db. if file exists, delete file then proceed to delete from db
    • after deleting this photo from db, check if there are children revision photos (aka edit/crop) and send the same delete command to them
    • (this after delete behavior should be handled via a one-way cascade delete


    Asset class should include asset groups

    A good example would be Casset, but it seems that the developer has stopped updating it and I fear it may become obsolete in near future. I don't see any other alternative packages that are as straightforward as Casset.


    Perhaps Fuelphp could even adopt Casset as a more robust complement to the existing Asset class.


    Modules and HMVC

    Both of these are still a huge mystery for newcomers.

    While there is fuel-depot source available, it is still quite difficult to wrap your head around the concepts it uses.

    Screencasts/Tuts on straightforward concepts would be greatly appreciated and will probably help make fuelphp much more popular.

    Example concepts would be:
    Create a themed admin backend
    • Demonstrates oil (possibly), auth, ORM (maybe), form, asset, themes, templates
    Create a users module and how to use Modules and HMVC to generate a user login ajax widget (login form, then user details)
    • Demonstrates Controller_rest/hybrid, HMVC, modules, validation, custom validation and error messages etc
    Just by having these two sections would demonstrate fuelphp's capabilities and potential.


  • That's a very long post, I will try to give you some feedback on these points.

    Upload:
     1.6 will have a completely rewritten Upload class, which will use a file object for each file uploaded, which you can access individually or as a group, depending on how you name them. For example, if you have four fields with name "file[]", when you ask for File objects named "file", you will get all four. It will also allow you to apply a different config for each file.

    Cascade delete:
    Will work on any relation you enable it on. Usually, it will only make sense on everything but a belongs_to (if you delete a child, you normally don't want to delete the parent). It cascades (as the name implies), so be careful on which relation you define it.

    Observers:
    There is no need to extend existing observers, they do a specific task, and there's no reason to modify them. As for writing observers, http://fuelphp.com/docs/packages/orm/observers/intro.html tells you how to add an observer to a model. If you have created your observer according to http://fuelphp.com/docs/packages/orm/observers/creating.html in app/classes/observer/test.php, you would use "Observer_Test" as observer name in your model definition. After all, it's a class as any other. In your example, you should attach the observer to the "before_delete" event.

    Asset groups
    I don't understand what you mean with asset groups. But then again, I don't know Casset. If this is about saying "I have an asset group called "header", and I want to add these three CSS files, and these two JS files, and then in your page template render the entire group in one go, you can already do that with the Asset class. If you mean something else, please explain.

    Modules and HMVC
    Modules is pretty strait-forward. A module has exactly the same structure as app. It only lives in a namespace, and the namespace must be equal to the module name. As for routing, where an app controller is accessed using http://yourhost/controller/method/params, you access a module using http://yourhost/module/controller/method/params. As to HMVC, it's nothing more then manually coding the request normally initiated by the browser, using the Request class.

    Documentation
    We are very aware that the docs at the moment are very clinical, and very geared towards API documentation. This is going to change. For the upcoming v2.0, the documentation will be more in book-style, with concepts, how-to's and explanations. There will be separate API docs, which are already available via this website.

    The current docs are hard-coded in HTML, which makes maintenance very hard. The new docs will be written in markdown, which is a lot easier for people to learn and use. And since github supports online editing and a markdown editor, it will be very easy to fork the docs repository, edit the page online, and send a pull request back with your changes. Without using any git locally. We hope this will increase the number of contributions from the community.

    Writing documentation is hard work, and takes up a lot of time. Writing good documentation is even harder. We're only a small team, not company funded like most other frameworks, so we can't do everything ourselfs. So sometimes we have to take shortcuts, and documentation unfortunately has been one of them.
  • Regarding Asset groups, I should've given a better example.

    Casset has groups with dependencies which I think Asset can benefit from.

    For example, I want to set the jquery.imgareaselect plugin to depend on the jquery and jquery-ui groups so that I can crop an image upload in a modal window.


    Will be looking forward to future versions of fuelphp. There's a reason why the people who're still around using fuel are still using fuel - because we love what we've seen and love the direction fuel future is going.

    I liked how CodeIgniter started, I remember 1.2.x when a ton of screencasts started flooded in and got many people running because of the solid examples. The closest thing is a series of nettut plus videos by Phil Sturgeon but it's been a year, and not too accessible as it's a premium service. I think fuelphp can benefit from freely available screencasts.

  • Absolutely right. Now let's find someone to make them... :)

Howdy, Stranger!

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

In this Discussion