May 27 2015

Disabling Eager Loading Eloquent Model Relations in Laravel 4 and 5

Category: Laravel,Laravel 5FractalizeR @ 1:12 pm

Since accidental lazy-loading almost always lead to performance problems, I was seeking a way to disable it. The solution is easy. Just define somewhere the following trait and use it in your model when you need to disable lazy loading:

* Class OnlyEagerLoadedModelTrait
 *
 * @package FH\Stock\Model
 */
trait EagerLoadOnlyTrait
{
    /**
     * @param string $method
     */
    protected function getRelationshipFromMethod($method)
    {
        $modelName = static::class;
        throw new LogicException(
            "EagerLoadedOnlyTrait: Attempting to lazy-load relation '$method' on model '$modelName'"
        );
    }
}

 

class CategoryUser extends Eloquent
{
    use EagerLoadOnlyTrait;
}

Tags: , , ,


May 02 2011

phpSweetPDO on GitHub

Category: PHP,Software releasesFractalizeR @ 1:50 am

Some time ago I blogged about creating nice PDO wrapper. Recently I’ve created a repository for my small PDO wrapper on GitHub: https://github.com/FractalizeR/phpSweetPDO

Library is released under Apache License. Feel free to use it!

Tags: ,


Apr 23 2011

Smarty extention for Silex framework

Category: Silex framework,Software releasesFractalizeR @ 10:56 pm

I’ve just released a first version of Smarty extension for Silex framework. You can take it here

Silex is a PHP microframework for PHP 5.3. It is built on the shoulders of Symfony2 and Pimple and also inspired by sinatra.

A microframework provides the guts for building simple single-file apps.


Nov 17 2010

Joomla’s Slick RSS (mod_slick_rss) improved and reworked for Joomla 1.5 and PHP 5.3

Category: Joomla addonsFractalizeR @ 2:02 pm

Hello.

Recently I was upgrading my websites on Joomla and moved them to PHP 5.3. I noticed too many errors from mod_slick_rss extension coming to PHP log. I’ve fixed them and added some new options:

  • Some new CSS classes to further style layoout
  • Ability to sort feeds by date or by their original order in the feed
  • Header and footer texts to display before and after the feed
  • Ability to output item date in the feed in a given format

You can download updated version here.


Aug 14 2008

[VBulletin Addon] “Edit User” Button in postbit

Category: Software releases,VBulletin Add-onsFractalizeR @ 5:38 pm

Preable:

I turned VBulletin forum into support system for our customers. In some forums users post requests to activate their access to some subforums. Administrator looks through all the requests, verifies data, provided by each user and sets secondary usergroups for certain user according to request. Each time having checked user data, administrator needs to go to user profile and click Options there to go to user edit window.

What this hack does?

This hack adds a button Edit User to each post. Having clicked this button opens /admincp/user.php?do=edit&u=$post[userid] page in new window. So, my staff needs only one click to access user account data.
Hack is fully customizable. The following parameters are adjustable:

* Window height and width
* Button icon
* User groups for which this button is shown
* Button location (choose from 9 possible)

Continue reading “[VBulletin Addon] “Edit User” Button in postbit”

Tags: ,


Aug 08 2008

[VBulletin Addon] VBulletin Antivirus

Category: Software releases,VBulletin Add-onsFractalizeR @ 5:45 pm

Powerful VBulletin addon, that scans every attachment any user uploads to your forum for viruses and allows to execute various actions if any virus is found. Hack requires PHP 5.x. and (depending on driver) PHP AV extensions or some antivirus software installed on PC

Continue reading “[VBulletin Addon] VBulletin Antivirus”

Tags: , , ,


Aug 07 2008

[VBulletin addon] Show items, awaiting moderation in notifications area

Category: Software releases,VBulletin Add-onsFractalizeR @ 8:18 pm

What does it do?
This hack shows all items, that require moderation in a notifications area. Items are grouped by type:

Continue reading “[VBulletin addon] Show items, awaiting moderation in notifications area”

Tags: , , , , , ,