-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from bakaphp/feature-relationship-save
- Loading branch information
Showing
7 changed files
with
201 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Baka\Contracts\Http\Api; | ||
|
||
use Phalcon\Http\Response; | ||
|
||
trait CrudBehaviorRelationshipsTrait | ||
{ | ||
use CrudBehaviorTrait; | ||
|
||
/** | ||
* Parent Primary Key Data. | ||
* | ||
* @var int|string | ||
*/ | ||
protected $parentId; | ||
|
||
/** | ||
* Get the record by its primary key. | ||
* | ||
* @param mixed $id | ||
* | ||
* @throws Exception | ||
* | ||
* @return Response | ||
*/ | ||
public function getById($id) : Response | ||
{ | ||
$id = $this->router->getParams()['id']; | ||
return parent::getById($id); | ||
} | ||
|
||
/** | ||
* Update a record. | ||
* | ||
* @param mixed $id | ||
* | ||
* @return Response | ||
*/ | ||
public function edit($id) : Response | ||
{ | ||
$id = $this->router->getParams()['id']; | ||
return parent::edit($id); | ||
} | ||
|
||
/** | ||
* Delete a Record. | ||
* | ||
* @throws Exception | ||
* | ||
* @return Response | ||
*/ | ||
public function delete($id) : Response | ||
{ | ||
$id = $this->router->getParams()['id']; | ||
return parent::delete($id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters