Skip to content
This repository was archived by the owner on Jul 6, 2020. It is now read-only.
This repository was archived by the owner on Jul 6, 2020. It is now read-only.

passing a parameter to a __construct #30

Open

Description

@dlangille

If I have this:

<?php
namespace freshportsAPISearch;
require_once($_SERVER['DOCUMENT_ROOT'] . '/../classes/ports.php');
#GLOBAL $db;
class Search {
    protected $db;
    function __contructor($db) {
      $this->db = $db;
      echo 'into __contructor';
    }

How can I pass a value to that function?

e.g. if I'm doing this:

Server::create('/--/api/search/', 'freshportsAPISearch\Search')
    ->setDebugMode(DEBUG)
    ->collectRoutes()
->run();

Activity

  1. marcj commented on Mar 6, 2019

    @marcj
    Owner

    That's currently not support. Maybe we could allow to pass in a factory as second argument for Server::create. If you provide a pull-request, I'll merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions