Skip to content

Commit

Permalink
fixed non static
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbakker committed Jan 30, 2023
1 parent bb7445f commit cfa81ce
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Components/Helpers/ApiHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ public static function getMethod($queryType) {
* @return string
*/
public static function getModelPath($name) {
$model = Inflector::classify($name);
return "Afosto\ApiClient\Models\\" . Inflector::pluralize($model) . "\\" . $model;
$model = (\Doctrine\Inflector\InflectorFactory::create()->build())->classify($name);
return "Afosto\ApiClient\Models\\" . (\Doctrine\Inflector\InflectorFactory::create()->build())->pluralize($model) . "\\" . $model;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Components/ModelTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function delete() {
* @return string
*/
public function getRoute() {
return strtolower(Inflector::pluralize($this->getName()));
return strtolower((\Doctrine\Inflector\InflectorFactory::create()->build())->pluralize($this->getName()));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Models/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class Relation extends Component {
public function __construct(Model $source, $attribute) {
list($this->model, $this->type) = $source->getRelations()[$attribute];
if ($this->isRel()) {
$this->classPath = 'Afosto\ApiClient\Models\\' . Inflector::pluralize($this->_getModelForRel()) . '\\' . $this->model;
$this->classPath = 'Afosto\ApiClient\Models\\' . (\Doctrine\Inflector\InflectorFactory::create()->build())->pluralize($this->_getModelForRel()) . '\\' . $this->model;
} else if ($this->isReference()) {
$this->classPath = 'Afosto\ApiClient\Models\\' . Inflector::pluralize($this->_getModelForReference()) . '\\' . $this->_getModelForReference();
$this->classPath = 'Afosto\ApiClient\Models\\' . (\Doctrine\Inflector\InflectorFactory::create()->build())->pluralize($this->_getModelForReference()) . '\\' . $this->_getModelForReference();
} else {
$this->classPath = $source->getNameSpace() . '\\' . $this->model;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/WebhookTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ abstract public function setAttributes($attributes);
*/
public function getWebhookUrl($action) {
$params = [
'model' => Inflector::tableize($this->getName()),
'model' => (\Doctrine\Inflector\InflectorFactory::create()->build())->tableize($this->getName()),
'action' => $action,
];
if (defined('WEBHOOK_KEY')) {
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Definition.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private function _getName($name) {
* @return string
*/
private function _getNameSpace($name) {
return Inflector::pluralize(current(explode('_', $name)));
return (\Doctrine\Inflector\InflectorFactory::create()->build())->pluralize(current(explode('_', $name)));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private function _gatherPaths() {
$this->_paths = [];
foreach ($this->_swaggerSource['paths'] as $path => $pathData) {
$path = current(explode('/', substr($path, 1)));
$this->_paths[] = \Doctrine\Inflector\Inflector::singularize($path);
$this->_paths[] = \Doctrine\Inflector\(\Doctrine\Inflector\InflectorFactory::create()->build())->singularize($path);
}
$this->_paths = array_unique($this->_paths);
}
Expand Down

0 comments on commit cfa81ce

Please sign in to comment.