Jump to content

JohanM

New Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by JohanM

  1. @Barand Tnx for the answer, but I'm getting no results on either of those 2 queries
  2. I'm bashing my head for some time now on how to resolve this issue (using PHP and MySQL) ... $array = ['C1', 'C2', 'C3', 'C4', 'C5', 'T1', 'T2', 'T3', 'T4', 'T5', 'T6', 'L1', 'L2', 'L3', 'L4', 'L5'] I'm getting in request 2 parameters: value_from and value_to Each record in the db table has those 2 columns (value_from and value_to) Say for example i have 2 records looking like this: id: 2, name: test1, value_from: C1, value_to: L3 id: 3, name: test2, value_from: C3 value_to: T5 in the request i get this json payload: value_from: C4, value_to: L2 with this parameters i should somehow retrieve 1 record - with the id: 2 because input parameters fit the range Any idea how this might be possible or what should the sql query look like? P.S. The $array is just a code representation of user selected input based on the front and yes, it cannot be changed, rearranged, meaning it has to look like that
  3. Hi guys! I have a specific requirement and need some help Say i have an external api library with Client class looking like this: class Client { some constants.. private props.., __construct() public static function create($url) { some code } public static function authenticate($token) { some code } ...dozen other methods } Current way of instantiating in every single other class where i need the client: use Client; MyFetchController { private $client; public function __construct() { $this->client = Client::create(getenv('URL'))->authenticate(getenv('TOKEN')) } $this->client->use other methods in Client class } Is there a way to wrap that class so i have external parameters loaded through .env file automaticaly available on new wrapper class intialization with something like this: MyFetchController { private $client; public function __construct(WrappedClient $client) { $this->client = $client } public function getData() { $data = $this->client->parse(...) } } Basically what i need is a class ready for DI in all other classes without inserting required auth and other parameters in constructor every single time
  4. Hi guys! I have a specific requirement and need some help Say i have an external api library with Client class looking like this: class Client { some constants.. private props.., __construct public function create($url) { some code } public function authenticate($token) { some code } ...dozen other methods } Current way of instantiating in every single other class where i need the client: use Client; MyFetchController { private $client; public function __construct() { $this->client = Client::create(getenv('URL'))->authenticate(getenv('TOKEN')) } $this->client->use other methods in Client class } Is there a way to wrap that class so i have external parameters loaded through .env file automaticaly available on new wrapper class intialization with something like this: MyFetchController { private $client; public function __construct(WrappedClient $client) { $this->client = $client } public function getData() { $data = $this->client->parse(...) } } Basically what i need is a class ready for DI in all other classes without inserting required auth and other parameters in constructor every single time
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.