Commit ea5ec06d authored by Jens Segers's avatar Jens Segers

Merge pull request #568 from fungku/master

Fix Docblocks in Model class and Embed Relationship classes
parents 00d3b8b0 06e598a1
<?php namespace Jenssegers\Mongodb; <?php namespace Jenssegers\Mongodb;
use Carbon\Carbon;
use DateTime; use DateTime;
use MongoId;
use MongoDate; use MongoDate;
use Carbon\Carbon; use MongoId;
use ReflectionMethod;
use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Database\Eloquent\Relations\Relation;
use Jenssegers\Mongodb\Eloquent\Builder; use Jenssegers\Mongodb\Eloquent\Builder;
use Jenssegers\Mongodb\Relations\EmbedsOneOrMany;
use Jenssegers\Mongodb\Relations\EmbedsMany; use Jenssegers\Mongodb\Relations\EmbedsMany;
use Jenssegers\Mongodb\Relations\EmbedsOne; use Jenssegers\Mongodb\Relations\EmbedsOne;
use Jenssegers\Mongodb\Relations\EmbedsOneOrMany;
use ReflectionMethod;
abstract class Model extends \Jenssegers\Eloquent\Model { abstract class Model extends \Jenssegers\Eloquent\Model {
...@@ -38,7 +38,6 @@ abstract class Model extends \Jenssegers\Eloquent\Model { ...@@ -38,7 +38,6 @@ abstract class Model extends \Jenssegers\Eloquent\Model {
* Custom accessor for the model's id. * Custom accessor for the model's id.
* *
* @param mixed $value * @param mixed $value
*
* @return mixed * @return mixed
*/ */
public function getIdAttribute($value) public function getIdAttribute($value)
...@@ -73,8 +72,10 @@ abstract class Model extends \Jenssegers\Eloquent\Model { ...@@ -73,8 +72,10 @@ abstract class Model extends \Jenssegers\Eloquent\Model {
* Define an embedded one-to-many relationship. * Define an embedded one-to-many relationship.
* *
* @param string $related * @param string $related
* @param string $collection * @param string $localKey
* @return \Illuminate\Database\Eloquent\Relations\EmbedsMany * @param string $foreignKey
* @param string $relation
* @return EmbedsMany
*/ */
protected function embedsMany($related, $localKey = null, $foreignKey = null, $relation = null) protected function embedsMany($related, $localKey = null, $foreignKey = null, $relation = null)
{ {
...@@ -109,8 +110,10 @@ abstract class Model extends \Jenssegers\Eloquent\Model { ...@@ -109,8 +110,10 @@ abstract class Model extends \Jenssegers\Eloquent\Model {
* Define an embedded one-to-many relationship. * Define an embedded one-to-many relationship.
* *
* @param string $related * @param string $related
* @param string $collection * @param string $localKey
* @return \Illuminate\Database\Eloquent\Relations\EmbedsMany * @param string $foreignKey
* @param string $relation
* @return \Jenssegers\Mongodb\Relations\EmbedsOne
*/ */
protected function embedsOne($related, $localKey = null, $foreignKey = null, $relation = null) protected function embedsOne($related, $localKey = null, $foreignKey = null, $relation = null)
{ {
...@@ -311,7 +314,7 @@ abstract class Model extends \Jenssegers\Eloquent\Model { ...@@ -311,7 +314,7 @@ abstract class Model extends \Jenssegers\Eloquent\Model {
array_set($this->attributes, $key, $value); array_set($this->attributes, $key, $value);
return; return;
} }
parent::setAttribute($key, $value); parent::setAttribute($key, $value);
...@@ -406,6 +409,8 @@ return; ...@@ -406,6 +409,8 @@ return;
/** /**
* Remove one or more values from an array. * Remove one or more values from an array.
* *
* @param string $column
* @param mixed $values
* @return mixed * @return mixed
*/ */
public function pull($column, $values) public function pull($column, $values)
...@@ -446,7 +451,7 @@ return; ...@@ -446,7 +451,7 @@ return;
} }
/** /**
* Rempove one or more values to the underlying attribute value and sync with original. * Remove one or more values to the underlying attribute value and sync with original.
* *
* @param string $column * @param string $column
* @param array $values * @param array $values
...@@ -474,7 +479,7 @@ return; ...@@ -474,7 +479,7 @@ return;
/** /**
* Set the parent relation. * Set the parent relation.
* *
* @param Relation $relation * @param \Illuminate\Database\Eloquent\Relations\Relation $relation
*/ */
public function setParentRelation(Relation $relation) public function setParentRelation(Relation $relation)
{ {
...@@ -484,7 +489,7 @@ return; ...@@ -484,7 +489,7 @@ return;
/** /**
* Get the parent relation. * Get the parent relation.
* *
* @return Relation * @return \Illuminate\Database\Eloquent\Relations\Relation
*/ */
public function getParentRelation() public function getParentRelation()
{ {
......
<?php namespace Jenssegers\Mongodb\Relations; <?php namespace Jenssegers\Mongodb\Relations;
use MongoId;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Pagination\Paginator;
use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Pagination\Paginator;
use MongoId;
class EmbedsMany extends EmbedsOneOrMany { class EmbedsMany extends EmbedsOneOrMany {
/** /**
* Get the results of the relationship. * Get the results of the relationship.
* *
* @return Jenssegers\Mongodb\Eloquent\Collection * @return \Jenssegers\Mongodb\Eloquent\Collection
*/ */
public function getResults() public function getResults()
{ {
...@@ -23,7 +23,7 @@ class EmbedsMany extends EmbedsOneOrMany { ...@@ -23,7 +23,7 @@ class EmbedsMany extends EmbedsOneOrMany {
* @param \Illuminate\Database\Eloquent\Model $model * @param \Illuminate\Database\Eloquent\Model $model
* @return \Illuminate\Database\Eloquent\Model * @return \Illuminate\Database\Eloquent\Model
*/ */
public function performInsert(Model $model, array $values) public function performInsert(Model $model)
{ {
// Generate a new key if needed. // Generate a new key if needed.
if ($model->getKeyName() == '_id' and ! $model->getKey()) if ($model->getKeyName() == '_id' and ! $model->getKey())
...@@ -54,7 +54,7 @@ class EmbedsMany extends EmbedsOneOrMany { ...@@ -54,7 +54,7 @@ class EmbedsMany extends EmbedsOneOrMany {
* @param \Illuminate\Database\Eloquent\Model $model * @param \Illuminate\Database\Eloquent\Model $model
* @return Model|bool * @return Model|bool
*/ */
public function performUpdate(Model $model, array $values) public function performUpdate(Model $model)
{ {
// For deeply nested documents, let the parent handle the changes. // For deeply nested documents, let the parent handle the changes.
if ($this->isNested()) if ($this->isNested())
...@@ -270,10 +270,9 @@ class EmbedsMany extends EmbedsOneOrMany { ...@@ -270,10 +270,9 @@ class EmbedsMany extends EmbedsOneOrMany {
* Get a paginator for the "select" statement. * Get a paginator for the "select" statement.
* *
* @param int $perPage * @param int $perPage
* @param array $columns
* @return \Illuminate\Pagination\Paginator * @return \Illuminate\Pagination\Paginator
*/ */
public function paginate($perPage = null, $columns = array('*')) public function paginate($perPage = null)
{ {
$page = Paginator::resolveCurrentPage(); $page = Paginator::resolveCurrentPage();
$perPage = $perPage ?: $this->related->getPerPage(); $perPage = $perPage ?: $this->related->getPerPage();
......
<?php namespace Jenssegers\Mongodb\Relations; <?php namespace Jenssegers\Mongodb\Relations;
use MongoId;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use MongoId;
class EmbedsOne extends EmbedsOneOrMany { class EmbedsOne extends EmbedsOneOrMany {
...@@ -21,7 +21,7 @@ class EmbedsOne extends EmbedsOneOrMany { ...@@ -21,7 +21,7 @@ class EmbedsOne extends EmbedsOneOrMany {
* @param \Illuminate\Database\Eloquent\Model $model * @param \Illuminate\Database\Eloquent\Model $model
* @return \Illuminate\Database\Eloquent\Model * @return \Illuminate\Database\Eloquent\Model
*/ */
public function performInsert(Model $model, array $values) public function performInsert(Model $model)
{ {
// Generate a new key if needed. // Generate a new key if needed.
if ($model->getKeyName() == '_id' and ! $model->getKey()) if ($model->getKeyName() == '_id' and ! $model->getKey())
...@@ -49,9 +49,9 @@ class EmbedsOne extends EmbedsOneOrMany { ...@@ -49,9 +49,9 @@ class EmbedsOne extends EmbedsOneOrMany {
* Save an existing model and attach it to the parent model. * Save an existing model and attach it to the parent model.
* *
* @param \Illuminate\Database\Eloquent\Model $model * @param \Illuminate\Database\Eloquent\Model $model
* @return Model|bool * @return \Illuminate\Database\Eloquent\Model|bool
*/ */
public function performUpdate(Model $model, array $values) public function performUpdate(Model $model)
{ {
if ($this->isNested()) if ($this->isNested())
{ {
...@@ -74,7 +74,7 @@ class EmbedsOne extends EmbedsOneOrMany { ...@@ -74,7 +74,7 @@ class EmbedsOne extends EmbedsOneOrMany {
/** /**
* Delete an existing model and detach it from the parent model. * Delete an existing model and detach it from the parent model.
* *
* @param Model $model * @param \Illuminate\Database\Eloquent\Model $model
* @return int * @return int
*/ */
public function performDelete(Model $model) public function performDelete(Model $model)
......
<?php namespace Jenssegers\Mongodb\Relations; <?php namespace Jenssegers\Mongodb\Relations;
use MongoId;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Eloquent\Collection as BaseCollection; use Illuminate\Database\Eloquent\Collection as BaseCollection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\Relation;
use Jenssegers\Mongodb\Eloquent\Collection; use Jenssegers\Mongodb\Eloquent\Collection;
abstract class EmbedsOneOrMany extends Relation { abstract class EmbedsOneOrMany extends Relation {
...@@ -35,10 +34,10 @@ abstract class EmbedsOneOrMany extends Relation { ...@@ -35,10 +34,10 @@ abstract class EmbedsOneOrMany extends Relation {
* *
* @param \Illuminate\Database\Eloquent\Builder $query * @param \Illuminate\Database\Eloquent\Builder $query
* @param \Illuminate\Database\Eloquent\Model $parent * @param \Illuminate\Database\Eloquent\Model $parent
* @param \Illuminate\Database\Eloquent\Model $related
* @param string $localKey * @param string $localKey
* @param string $foreignKey * @param string $foreignKey
* @param string $relation * @param string $relation
* @return void
*/ */
public function __construct(Builder $query, Model $parent, Model $related, $localKey, $foreignKey, $relation) public function __construct(Builder $query, Model $parent, Model $related, $localKey, $foreignKey, $relation)
{ {
...@@ -126,7 +125,7 @@ abstract class EmbedsOneOrMany extends Relation { ...@@ -126,7 +125,7 @@ abstract class EmbedsOneOrMany extends Relation {
/** /**
* Shorthand to get the results of the relationship. * Shorthand to get the results of the relationship.
* *
* @return Jenssegers\Mongodb\Eloquent\Collection * @return \Jenssegers\Mongodb\Eloquent\Collection
*/ */
public function get() public function get()
{ {
...@@ -278,7 +277,7 @@ abstract class EmbedsOneOrMany extends Relation { ...@@ -278,7 +277,7 @@ abstract class EmbedsOneOrMany extends Relation {
* Convert an array of records to a Collection. * Convert an array of records to a Collection.
* *
* @param array $records * @param array $records
* @return Jenssegers\Mongodb\Eloquent\Collection * @return \Jenssegers\Mongodb\Eloquent\Collection
*/ */
protected function toCollection(array $records = array()) protected function toCollection(array $records = array())
{ {
...@@ -322,7 +321,7 @@ abstract class EmbedsOneOrMany extends Relation { ...@@ -322,7 +321,7 @@ abstract class EmbedsOneOrMany extends Relation {
/** /**
* Get the relation instance of the parent. * Get the relation instance of the parent.
* *
* @return Illuminate\Database\Eloquent\Relations\Relation * @return \Illuminate\Database\Eloquent\Relations\Relation
*/ */
protected function getParentRelation() protected function getParentRelation()
{ {
...@@ -366,6 +365,7 @@ abstract class EmbedsOneOrMany extends Relation { ...@@ -366,6 +365,7 @@ abstract class EmbedsOneOrMany extends Relation {
/** /**
* Get the fully qualified local key name. * Get the fully qualified local key name.
* *
* @param string $glue
* @return string * @return string
*/ */
protected function getPathHierarchy($glue = '.') protected function getPathHierarchy($glue = '.')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment