Skip to content

Commit cddbf16

Browse files
committed
Updates
1 parent 4025ea7 commit cddbf16

2 files changed

Lines changed: 25 additions & 4 deletions

File tree

PostmasterPlugin.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,25 @@ public function init()
5555

5656
require_once 'bootstrap.php';
5757

58-
foreach(craft()->postmaster_parcels->findEnabled() as $parcel)
58+
/*
59+
$plugin = $this;
60+
61+
craft()->on('postmaster.test', function(Event $event)
5962
{
60-
$parcel->init();
61-
}
63+
exit('asd');
64+
});
65+
66+
$this->raiseEvent('onTest', new Event());
67+
*/
68+
69+
craft()->on('plugins.loadPlugins', function(Event $event)
70+
{
71+
craft()->postmaster->onInit(new Event());
72+
73+
foreach(craft()->postmaster_parcels->findEnabled() as $parcel)
74+
{
75+
$parcel->init();
76+
}
77+
});
6278
}
6379
}

services/PostmasterService.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ class PostmasterService extends BaseApplicationComponent
1111

1212
protected $_parcelTypesIds = array();
1313

14+
public function onInit(Event $event)
15+
{
16+
$this->raiseEvent('onInit', $event);
17+
}
18+
1419
public function parcels($criteria = false)
1520
{
1621
return new Postmaster_ParcelCriteriaModel($criteria ?: array());
@@ -135,7 +140,7 @@ private function _registerObject($prop, $class, $instance)
135140
}
136141
else
137142
{
138-
throw new Exception(Craft::t('An object has already been registered with the name "'.$name.'" belonging to class "'.$class.'"."'));
143+
throw new Exception(Craft::t('An object has already been registered with the name "'.$obj->name.'" belonging to class "'.$class.'"."'));
139144
}
140145
}
141146
}

0 commit comments

Comments
 (0)