Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jun 8, 2017
1 parent cf13fbf commit dd45f70
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 29 deletions.
20 changes: 10 additions & 10 deletions src/Illuminate/Contracts/Database/ModelIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ class ModelIdentifier
*/
public $class;

/**
* The connection name of the model.
*
* @var string|null
*/
public $connection;

/**
* The unique identifier of the model.
*
Expand All @@ -27,18 +20,25 @@ class ModelIdentifier
*/
public $id;

/**
* The connection name of the model.
*
* @var string|null
*/
public $connection;

/**
* Create a new model identifier.
*
* @param string $class
* @param mixed $connection
* @param mixed $id
* @param mixed $connection
* @return void
*/
public function __construct($class, $connection, $id)
public function __construct($class, $id, $connection)
{
$this->id = $id;
$this->connection = $connection;
$this->class = $class;
$this->connection = $connection;
}
}
12 changes: 6 additions & 6 deletions src/Illuminate/Contracts/Queue/QueueableCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ interface QueueableCollection
public function getQueueableClass();

/**
* Get the connection of the entities being queued.
* Get the identifiers for all of the entities.
*
* @return string|null
* @return array
*/
public function getQueueableConnection();
public function getQueueableIds();

/**
* Get the identifiers for all of the entities.
* Get the connection of the entities being queued.
*
* @return array
* @return string|null
*/
public function getQueueableIds();
public function getQueueableConnection();
}
20 changes: 10 additions & 10 deletions src/Illuminate/Database/Eloquent/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,16 @@ public function getQueueableClass()
return $class;
}

/**
* Get the identifiers for all of the entities.
*
* @return array
*/
public function getQueueableIds()
{
return $this->modelKeys();
}

/**
* Get the connection of the entities being queued.
*
Expand All @@ -378,14 +388,4 @@ public function getQueueableConnection()

return $connection;
}

/**
* Get the identifiers for all of the entities.
*
* @return array
*/
public function getQueueableIds()
{
return $this->modelKeys();
}
}
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ public function getQueueableId()
}

/**
* Get the queueable identity for the entity.
* Get the queueable connection for the entity.
*
* @return mixed
*/
Expand Down
12 changes: 10 additions & 2 deletions src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,19 @@ trait SerializesAndRestoresModelIdentifiers
protected function getSerializedPropertyValue($value)
{
if ($value instanceof QueueableCollection) {
return new ModelIdentifier($value->getQueueableClass(), $value->getQueueableConnection(), $value->getQueueableIds());
return new ModelIdentifier(
$value->getQueueableClass(),
$value->getQueueableIds(),
$value->getQueueableConnection()
);
}

if ($value instanceof QueueableEntity) {
return new ModelIdentifier(get_class($value), $value->getQueueableConnection(), $value->getQueueableId());
return new ModelIdentifier(
get_class($value),
$value->getQueueableId(),
$value->getQueueableConnection()
);
}

return $value;
Expand Down

0 comments on commit dd45f70

Please sign in to comment.