« first day (2593 days earlier)      last day (2352 days later) » 

9:00 PM
There is no syntax error in that code 3v4l.org/dSNuS
 
@Fabor Are you assuming I am not lazy?
That's just racist
 
Go eat a kebab you tulip-field pipe-shmoking waffle-lover.
 
Soon bro
 
sorry I had 'title' => _htmlentities($product['product_name'] ?? $category['category_name']);,
thanx
 
Will get one next week and take pictures and everything like a proper instagram slut
hahahaha
 
9:01 PM
lol :-P
 
@daverandom
thanx
 
7 messages moved to Trash
 
I'm just gonna let that one sit for a few weeks until you have forgotten I did that and stumble upon it
 
I need to add you all on LinkedIn :B
 
Just like everything else you promise
:P
 
9:04 PM
@DaveRandom I digress.
 
I deleted my linkedIn after my old company started making us all associate ourselves with them on it.
 
You didn't just refuse?
 
Easier to say I don't have one.
Plus after your janitor endorses you for HTML it kind of lost its sense of importance.
 
Good call, why didn't you want to be associated with them?
 
Because they are pricks
 
9:06 PM
I didn't like idea of being forced to do it.
 
Is that a legal thing?
 
Depends on the country probably
 
legalities don't really mean anything when it comes to employer/employee, unless it's in their favor, most of the time.
That company sucked, thing was a facade, over charging people for crappy drupal builds. Over-zealous use of the word "Disrupt" and limited technological capacity.
 
It sounds like a lot of the companies out there
 
> Attempting to use Auryn as a replacement for factory methods would result in a lot of repeated code
 
9:12 PM
It annoys me because I am seeing people get clients, or jobs, not based off of their technological capacity or abilities but moreso their ability to sound like they know what they're doing
 
@Allenph why would there be any repeated code?
 
@Danack Because I can have a custom method which produces one of a set of defaults for me.
 
Please provide the source of the 'watched how two different people do the site'. As @tereško pointed out model is an abstraction layer; typically data source abstraction. So a database table would have a corresponding 'model class'. — David J Eddy 24 mins ago
why can't we downvote comments ?!
 
@Allenph how would that lead to repeated code?
 
@Danack It's the lack of that ability that would lead to repeated code.
 
9:15 PM
@Alesana Yep
 
I would say that I would just inject the DIC into the factory class on construction, but I understand that's a no-no...isn't it?
 
@Allenph I have no idea what you mean. If you have an example piece of code...I could probably help you with that, rather than talking past each other.
btw this is supported in Auryn:
class FooFactory {
   function createDefaultFoo() {
       return new Foo(1, 2, 3);
   }
}

$injector->delegate(Foo::class, [FooFactory::class, 'createDefaultFoo']);
any dependency for Foo, would then call the factory code.
 
@Allenph the relationship is other way around
 
@Danack Ahhhhhhhhhh. I saw that in the documentation, but now I realize what I would use it for.
Now I have a just general little turd who doesn't know what he's talking about question:

If you're configuring a single instance of the injector...doesn't that make it a weird global in a way? Thinking about it, I can't think of a reason it would be...it just seems...globall-ee.
 
no, because it never leaves the bootstrap scope
you are not supposed to inject it in any other class
it's what you use to kick off your code execution
 
9:22 PM
@Allenph not global but certainly a procedural piece of code where everything is hard-linked together.........that code exists in all projects. The injector allows you to separate your code into two parts:
i) a bootstrap layer where everything is procedural and effectively strongly coupled.
ii) a domain layer where everything is typed and everything can be replaced.
 
I don't think it counts as "procedural", more like "structured" (if you are referring to paradigms)
 
I have a very shit talk about this: docs.basereality.com/SolidStructure/#/15
 
Just seems...wrong. You guys have been drilling into my head SOLID OOP and then turn around and say "it's okay to be procedural sometimes."
 
btw, this is an example file of how I configure Auryn with the simple class to pass the values into injector.
 
how exactly is it procedural, @Allenph?
 
9:29 PM
@Allenph every PHP application starts in procedural code. You need a bootstrap layer to get up into SOLID-ish mode.
 
How it it not procedural? The Injector is a singleton. o.O
@Danack Yeah, that picture you linked kind of put that in perspective...it's kind of unavoidable.
 
e.g. every slim App where it does new App() - is hard coded to use that particular type, rather than having the appropriate type be injected.
of even just file_get_contents('app_config.json') - is hard-coded procedural.....
 
what are you talking about?
 
Yeah. I suppose.
@tereško That's not what I meant to say.
 
well .. that's what came out
 
9:31 PM
I meant there's just one instance and it's definitely configured procedurally.
 
I think you might have some strange ideas regarding what is procedural paradigm
 
@tereško Procedural programming is just creating a list of operations to be carried out with some functions thrown in there, as far as I understand.
 
@IROEGBU I'm guilty of that. :p
 
Easy to tell, you seem to be afraid of anything not a class
 
9:39 PM
I am afraid of anything that's not a class.I thought I was supposed to be up until a few seconds ago. Thanks.
 
Everything can be a class if you learn something from it
:P
 
@Danack So since you're not injecting the DIC into things like controllers...how do you get any use out of them? I'm assuming you don't just global $injector. Instantiating a new one with the same configuration, using global $injector and injecting it into the constructor of a new controller object all seem the same though.
 
    // Execute the callable
    $result = $this->injector->execute($callable);
That's how it calls controllers with github.com/Danack/SlimAurynInvoker
 
In procedural approach the code is split in reusable procedures (subroutines). It has two scopes - the the global (or better maybe - shared) scope and the subroutine scope. For every subroutine call (in order to convey the application state), you have to pass all the variables directly or import them from the global scope. The only way to alter the procedure's result is by altering the application state ... or more precisely - the part of application state, that is accessible to the procedure
 
your controller code shouldn't be aware of the injector.
 
9:43 PM
@Allenph and each procedure can alter the state of the application by either returning a result or altering directly the imported shared variables.
@Allenph you DIC create the controller and all it's dependencies ... and that's it
you seem to be missing the point
@Danack did I miss anything regarding procedural paradigm?
 
Don't turn your DIC in to a SL
 
procedural is not the right name......I can't thing of a better single name.
 
@tereško Isn't that just a complicated way of saying it's a series of steps with functions in it?
Those subroutines in practice most of the time are functions, aren't they?
But, thank you. That definitely clears it up for me.
 
in php there are only functions
other languages have more tools for procedural code
what you see more often in PHP is not really procedural code .. I tend to call it "include oriented programming" , which is basically "procedural code done wrong"
 
@Fabor I do know about SLs...and they were mentioned specifically in the Auryn docs too. That's what I'm trying to figure out.
 
9:53 PM
the DI container is basically a "smart factory", which creates an entire object tree based on it's dependencies, instead of building a single object
and a factory should not pass itself as a dependency to a class instance, that it creates
it is the same with DI containers
 
@tereško Does that mean after the initial call I'm going to end up injecting by hand anyway if I need an additional object?
Or is the point that I should never have to do that?
I think I should do some more homework before I continue asking questions. This is exactly the kind of shit fest I didn't want to bring into the main chat.
 
@Allenph if you scroll up, in the bootstrap file that I posted, you will see that I tend to pass Request instance in the method calls, that I execute on the constructed controllers
the difference is between composition and association
you should pass in the constructor the mandatory dependencies
 
@Allenph FTR there are some very limited cases where you would pass the injector.
 
@tereško Sure! But what if in a certain case I need to go get something else but not in other cases?
 
for example, your "login controller" (which tend to deal all the user-identification related shit) will always need the Authentication service, but it will not need the user's password
 
9:58 PM
Let me take a look at your file.
@Fabor Hold thy horses.
 
@Fabor can you name one
and I mean a case, that can't be refuted by "it's a design mistake"
only case that I can think of is: when you are refactoring include-oriented code to proper OOP .. as a temporary solution, during the migration process
 
I'll try and find the problem I had where that was the solution confirmed by Daniel, but here's a quote for the mean time.
Aug 19 '15 at 15:14, by rdlowrey
Yeah, I know what @Danack is doing there. The problem is that there are gray areas -- it's best to say "never pass an injector into anything" in the same way we make blanket statements like "never use goto" ... and these are valuable axioms. But there are times when wizards know what they're doing to and rules can be broken.
ping @Danack ^
 
@tereško frontcontroller / dispatcher
 
:P
 
10:05 PM
@Allenph you should try using slim with auryn with that invoker library.
it will be a lot more obvious once you start using it.
 
@PeeHaa why would you wrap that in a class to begin with? It's not like php code gets scared/cold if you run it without an object
 
And for the record, I have no problem with passing the injector into factories, because life is to short to do 'everything properly' all the time.
 
@Danack I already started doing a small blog with just plain PHP and Fast Route. Seems like I could incorporate it into that instead?
 
Sep 28 at 12:36, by Danack
Jul 31 '16 at 20:33, by Danack
$injector->share($injector); //yolo
 
Wes told me to try it without Slim or Symfony.
 
10:06 PM
@Allenph sure. Though that is all Slim is really, simple wrapper to create the PSR-7 request objects, and then it uses fast route to do the routing. There's not really that much else in there.
but connecting it up by hand yourself would be a fine learning experience.
 
I feel like I'm REALLY behind on the theory of all this stuff. It feels a lot like the first time I ever heard "MVC". I'm hoping I have a similar "click" moment at some point.
But it's been months since Wes first started head-desking with me. Actually almost a year probably.
 
Probably happen if you start using Auryn
Jimbo has done a bunch of talks on it too.
 
@Allenph that "mvc click" was probably sound of something breaking
 
@Danack I'll probably pull Slim in then. No use in writing an autoloader.
 
composer comes with autoloader
 
10:12 PM
^ That's what I was using.
@tereško Looking at your bootstrap file didn't answer my question. But thinking about it, I can't think of a case where my question would be valid, so.
 
@tereško because there is logic in it which fits in a class
 
I am talking about people who put in bootstrap php file:
<?php
require __DIR__ . '/vendor/autoload.php';

$app = new App;
$app->run();
^ dont do this
 
@tereško … why would you ever do that?!
 
@bwoebi because that adds more oo to the oop
.. probably
I have see way too many frameworks doing that
 
What if your bootstrap file in 14,000 lines long? Just break it up into files and includes?
 
10:22 PM
traits and use Trait1, Trait2, Trait3; :x
 
@Allenph then you kill it with fire, before it lays eggs
 
@Trowski by the way... you are actually truncating data for unsigned long longs (or for anything larger to 32 bit or unsigned 32 bit on 32 bit builds) with that (int) cast. Any integer between 2^63 and 2^64-1 will be truncated to 2^63-1 then. Currently with binary protocol I'm just converting to float and loosing precision instead. (github.com/amphp/mysql/blob/…) both are bad, I think.
I'm not sure what to do about that though
 
I have a 4 day weekend for Thanksgiving...maybe I'll finally have some time to figure all this out. Thanks for the help teresko & Danack.
Also Fabor and PeHaa.
 
Trial by fire on Tuesday then.
 
@Allenph but to be a bit more serious: in that case you be an indication that you are using the wrong tool .. or misusing the ones you have
 
10:26 PM
I was just thinking about a huge REST API with a literal crap-ton of routes and domain objects that all have to have configuration settings in the injector.
 
@Trowski probably … sigh. The ideal way is probably using a string representation for both protocols (binary and text) in order to get a perfectly reversible format.
 
@Allenph routes don't go in there... See @tereško's example for how you should manage routes and configurations
 
@Allenph that bootstrap file is from a huge REST API
well .. ok ... it is actually a cut down version, because the real file contains additional conditionals for loading DI configs for production, development, staging or testing
and it also has 6 additional lines for fixing symfony's inability to understand multiplart/form-data with PUT requests
... well .. ok, maybe not huge
 
@tereško PHP doesn't know how to do that in general. :p I remember that being a huge pain in my ass a few months ago.
@IROEGBU Is he storing all his routes in a YAML file?
 
10:36 PM
That's why I asked that question.
Just wanted to confirm...because I've always assigned routes to some PHP object in a few named files.
 
You can use a separate php file instead of yaml... the format doesn't matter.
 
well .. that's where I start from
then, when I need specific routes, I add those custom cases
and you do not need to use yaml for it - you can do it also with a php file or json file
 
I can see how JSON would be a bit hard to read.
You don't match HTTP verbs directly to controller methods?
 
didn't you see that in the bootstrap file?
 
@tereško This is actually elegant! I never thought of it this way... It reduces the length of that file drastically.
 
10:42 PM
You append the action in your config file to the name of your methods.
 
yes, because you would do different things for every request method anyway
there is no point in having additional if in your controller
 
I see.
 
@IROEGBU look at those as the "fallback options". They are what the router picks up, when all the "special cases" above have had no match
for example, these will not pick the users email-verification link
for that you would have to write a separate rule
but in a REST API case, there are not even those exceptions
 
Yes, I understand... It's just that, I've always been more "explicit", it never occurred to me that it could be done this way.
 
:D
 
10:57 PM
Thanks
 
11:12 PM
Hello people :D I'm developing an app with the twitter real time api.I'v managed to connect to the stream and get the wanting data.Now I'm stuck at the most stupid part.When i run the script i can't connect to the database.But when I run it over postman it works.When i run it over the script i get "SQLSTATE[HY000] [2002] No such file or directory ".
 

« first day (2593 days earlier)      last day (2352 days later) »