Permalink
Browse files

Fixed element_name_plural when namespaces are used, closes #16

  • Loading branch information...
1 parent 4745379 commit 02309d7145ec595c5de0c129ffc6ed9ce08ecd0e @jbroadway committed Aug 20, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 ActiveResource.php
View
@@ -158,7 +158,6 @@ function __construct ($data = array ()) {
$this->_data = $data;
// Allow class-defined element name or use class name if not defined
$this->element_name = $this->element_name ? $this->element_name : strtolower (get_class ($this));
- $this->element_name_plural = $this->pluralize ($this->element_name);
// Detect for namespaces, and take just the class name
if (stripos($this->element_name, '\\'))
@@ -167,6 +166,9 @@ function __construct ($data = array ()) {
$this->element_name = end($classItems);
}
+ // Get the plural name after removing namespaces
+ $this->element_name_plural = $this->pluralize ($this->element_name);
+
// if configuration file (config.ini.php) exists use it (overwrite class properties/attribute values).
$config_file_path = dirname (__FILE__) . '/' . 'config.ini.php';
if (file_exists ($config_file_path)) {

0 comments on commit 02309d7

Please sign in to comment.