nicksagona on 5.3.3
nicksagona on master
Patch SqlSrv options array merge (compare)
nicksagona on v5-dev
Patch SqlSrv options array merge (compare)
nicksagona on 5.3.2
nicksagona on 4.5.11
nicksagona on 4.5.11
nicksagona on master
Patch expression issue for NOT … (compare)
nicksagona on v5-dev
Patch expression issue for NOT … (compare)
nicksagona on 3.7.1
nicksagona on master
Patch PHP 8 issue with named pa… (compare)
nicksagona on v3-dev
Patch PHP 8 issue with named pa… (compare)
nicksagona on 4.5.10
nicksagona on 4.5.10
nicksagona on v4-dev
Patch dirty save (compare)
pop-http
is complete... not live yet... I haven't cut a release yet. If anyone wants to look it over, you can do so over on the v4-dev branch here: https://github.com/popphp/pop-http/tree/v4-dev
pop-http
v4. I believe BC breaks have been kept to a minimum and the main thing that will have to change is any references to Pop\Http\Request
and Pop\Http\Response
will have to change to Pop\Http\Server\Request
and Pop\Http\Server\Response
, respectively
pop-kettle
, make sure you have v1.3.0 which now comes with the proper updates to the underlying templates to utilize pop-http
v4.
class Movies extends Pop\Db\Record
{
public function qualities()
{
return $this->hasMany('Qualities', 'movie_id'); // 'movie_id' is the FK
}
}
class Qualities extends Pop\Db\Record
{
public function movie()
{
return $this->belongsTo('Movies', 'id'); // 'id' is the primary key that is used to get the parent relationship
}
}
$movie = Movies::findById(1); // Get a single movie
$qualities = $movie->qualities(); // Get all qualities of that movie
print_r($movie->toArray());
print_r($qualities->toArray());
// Movie
Array
(
[id] => 1
[title] => Avengers
)
// Qualities of the movie
Array
(
[0] => Array
(
[id] => 1
[movie_id] => 1
[type] => Great
)
[1] => Array
(
[id] => 2
[movie_id] => 1
[type] => Exciting
)
)
$quality = Qualities::findById(1); // Get a single quality
$parentMovie = $quality->movie(); // Get that quality's parent movie
print_r($quality->toArray());
print_r($movie->toArray());
// Quality
Array
(
[id] => 1
[movie_id] => 1
[type] => Great
)
// Movie the quality belongs to
Array
(
[id] => 1
[title] => Avengers
)
movies
and a table qualities
with a FK qualities
.movie_id
referencing back to movies
.id
Thank you, Mr. Nick Sagona, for answering my question quickly. However, I don't think that's what I wanted to ask.
For example, in Laravel, a route is defined as follows:
Route::get('user/{id}/profile', function ($id) {
//
})->name('profile');
and to generate the url address (for href in <a>) the code is used:
$url = route('profile', ['id' => 1, 'photos' => 'yes']);
// /user/1/profile?photos=yes
Can something similar be done in popphp ?
/users/:id
or /users[/:id]
function ($id) { }
popphp
components (router, controller) and the view component
Ok. Understand . Sorry if I'm holding you back too much and thanks again for trying to help me. I read all your documentation about the PopPHP framework in the last two days and I didn't find what I asked as a question here. The PoPPHP framework is very nice and I would like to move on from Laravel to use it.
Let me try to ask you like this. In PopPHP routes we can define as follows:
$config = [
'routes' => [
'/products/:id' => [
'controller' => 'MyApp\Controller\ProductsController',
'action' => 'index',
'controllerParams' => [
'id' => 789
]
]
]
];
$app = new Pop\Application($config);
We have a defined route in the code above that responds to the url address /products/:id. The Route object has the properties controller, action, and controllerParams (but as far as I can see property name does not exist as in Laravel for the reverse process - generating url addresses via route object).
In PoPPHP, I assume that this route can be accessed using the code:
$myRoute = $app->router()->getRoutes()['/products/:id'];
There was a possibility to generate a url address from the route (for example for the href Edit button in the html table in the 3rd row the generated url address would be).
/products/3 - for dispaly details page for product 3