polyfony-inc / polyfony

Polyfony is an intuitive, light and powerful PHP micro-framework
GNU General Public License v3.0
10 stars 1 forks source link

Better Models hierarchy using camelcase as namespace structure #178

Open AnnoyingTechnology opened 6 years ago

AnnoyingTechnology commented 6 years ago

somewhat related to #235

Assuming a table SitesPhotos exists The framework would try to instanciate objects from Models\Sites\Photos.php

namespace Models\Sites;
class Photos extends Polyfony\Record {
}

In case the file does not exist, the framework would try to instanciate Models\SitesPhotos.php

namespace Models;
class SitesPhotos extends Polyfony\Record {
}

Le 19/03/2018 à 09:18, Julien a écrit :

juste une idée

imagines deux tables

"SitesPhotos"

"SitesAttachments"

le framework pourrait les rechercher dans

Models/Sites/Photos.php class Photos extends Record {}

Models/Sites/Attachments.php class Attachments extends Record {}

ça permettrait de mieux ranger. Il se baserait sur la capitalisation

AnnoyingTechnology commented 6 years ago

Interestingly, we could encounter the following

Models\Photos.php

class Photos extends Polyfony\Record {}

Models\Projects\Photos.php

class Photos extends Models\Photos {}

Models\Sites\Photos.php

class Photos extends Models\Photos {}