Giter Site home page Giter Site logo

nette / component-model Goto Github PK

View Code? Open in Web Editor NEW
256.0 36.0 9.0 223 KB

⚛ Component model foundation for Nette.

Home Page: https://doc.nette.org/component-model

License: Other

PHP 100.00%
nette nette-framework php component-object-model component-tree

component-model's Introduction

Nette Component Model

Downloads this Month Tests Coverage Status Latest Stable Version License

Introduction

Components are the foundation of reusable code. They make your work easier and allow you to profit from community work. Components are wonderful. Nette Framework introduces several classes and interfaces for all these types of components.

Documentation can be found on the website.

If you like Nette, please make a donation now. Thank you!

Installation

The recommended way to install is via Composer:

composer require nette/component-model

It requires PHP version 8.1 and supports PHP up to 8.3.

component-model's People

Contributors

dg avatar enumag avatar fprochazka avatar jantvrdik avatar mabar avatar majkl578 avatar vrana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

component-model's Issues

Can Container implement IteratorAgregate?

Describe use case:
If i prepare structure of the form by $form->addContainer('foo'); in every template i must use {foreach $form->getComponent('foo')->getComponents() as $key => $input} this help make shorter {foreach $form->getComponent('foo') as $key => $input}, because i never need parameters from getComponents() $deep and $fileter in template.

Implementation is easy.

namespace Nette\ComponentModel;

use Nette;

class Container extends Component implements IContainer, \IteratorAggregate
{

	public function getIterator()
	{
		return $this->getComponents();
	}

}

What do you think?

Container::getComponent() throws exception for already attached components

Because there is a check for component parent presence in https://github.com/nette/component-model/blob/master/src/ComponentModel/Container.php#L142 it's impossible return already created and attached controls.

class MyControl {

protected function createComponentTest() {
  return $this->anotherControlParent->getComponent("Test");
}

If another parent has attached component "test", exception about unknown component "test" is thrown. Throw such exception in this situation is misleading.

Maybe such component don't need to be attached to current parent but getComponent() method can return such component. That component is already attached to another parent doesn't matter.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.